Don P
Don P

Reputation: 63788

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)?

Example:

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?

https://pleth-test.herokuapp.com/

I tried using overflow and text-wrap CSS properties, but couldn't get anything to work.

Upvotes: 0

Views: 728

Answers (2)

Nirjhar Vermani
Nirjhar Vermani

Reputation: 1245

white-space:nowrap or white-space:pre.

Upvotes: 0

Barry127
Barry127

Reputation: 1212

Add this to your css:

white-space: nowrap;

Upvotes: 2

Related Questions