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?
543
votes
5 Answers
1013
votes
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
162
votes
37
votes
If you want to achieve this selectively (ie: only to that particular link), you can use a non-breaking space instead of a normal space:
<li>submit resume</li>
https://en.wikipedia.org/wiki/Non-breaking_space#Encodings
edit: I understand that this is HTML, not CSS as requested by the OP, but some may find it helpful…
15
votes