简体   繁体   中英

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 bad. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM