How to prevent line breaks in list items using CSS

Rajasekar picture Rajasekar · Sep 5, 2009 · Viewed 390.7k times · Source

I'm trying to put a link called Submit resume in a menu using a li tag. Because of the whitespace between the two words it wraps to two lines. How to prevent this wrapping with CSS?

Answer

n1313 picture n1313 · Sep 5, 2009

Use white-space: nowrap;[1] [2] or give that link more space by setting li's width to greater values.


[1] § 3. White Space and Wrapping: the white-space property - W3 CSS Text Module Level 3
[2] white-space - CSS: Cascading Style Sheets | MDN