Donny P Donny P - 1 year ago 48
CSS Question

Prevent text wrapping within an element

How can you force text within an element to not wrap, and have the element's width still determined by its contents (instead of manually setting width)?


On this page you can see a green button with the text "Get Started". For smaller screen sizes, the text wraps. How can I prevent this?

I tried using

CSS properties, but couldn't get anything to work.

Answer Source

Add this to your css:

white-space: nowrap;