htmlcssword-wrap

How to prevent line breaks in list items using CSS


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?


Solution

  • 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