how to avoid wrap in DIV?
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 ba开发者_如何学运维d. How can I avoid text in a div not wrap?
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
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.
精彩评论