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? 回答1: Use white-space: nowrap; 1 , or give that link more space by setting li 's width to greater values. 回答2: You could add this little snippet of code to add a nice "…" to the ending of the line if the content is to large to fit on one line: li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }