Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In CSS, how do I make the text not go on a 2nd line?

Tags:

css

templates

Suppose I have text inside a div right now. When I resize my browser to make it really small, the text goes on a 2nd line instead of making the scroll bar.

Instead, I would like to keep the text all on one line and just have a horizontal scroll bar. How can I do this? WIth overflow?

like image 541
TIMEX Avatar asked Dec 22 '22 05:12

TIMEX


2 Answers

Use white-space:

#myDiv { white-space: nowrap; }

Or:

<div style="white-space: nowrap;">Long text that I do not want wrapped</div>
like image 109
Nick Craver Avatar answered Jan 08 '23 01:01

Nick Craver


You can turn off automatic wrapping using the white-space property, like this:

#theDiv { white-space: nowrap }
like image 25
phisch Avatar answered Jan 08 '23 03:01

phisch