I have a div but when the text inside it is too long, it will wrap and make the div multiple lines. This makes the page bad. How can I avoid text in a div not wrap?
Asked
Active
Viewed 1,109 times
3
-
http://stackoverflow.com/questions/502500/css-word-wrapping-in-div – Sergey Vedernikov Feb 18 '11 at 08:54
-
Just add the following style: ``– Shadow The GPT Wizard Feb 18 '11 at 08:56
2 Answers
4
There is a reason the test is wrapping. But if you don't care for then then you set the overflow style to visible and set the style="white-space: nowrap;"
style as well

Shiv Kumar
- 9,599
- 2
- 36
- 38
1
The answer depends on the desired result. If you MUST keep the div fixed size, sacrificing some of the visible text that doesn't fit, use width
, height
and overflow: hidden
, otherwise you use white-space: nowrap
as already suggested.

Dennis Kreminsky
- 2,117
- 15
- 23