How to avoid wrapping in a div?

I have a div, but when the text inside it is too long, it will wrap and make the div a few lines. This makes the page bad. How can I avoid text in a div not wrap?

+3
source share
2 answers

There is a reason the test wraps around. But if you don’t care, then you set the overflow style to visible and set the style style="white-space: nowrap;"as well

+4
source

The answer depends on the desired result. If you SHOULD keep the div size fixed by sacrificing some visible text that does not fit, use width, heightand overflow: hidden, otherwise, you will use white-space: nowrapas suggested.

+1
source

Source: https://habr.com/ru/post/1792995/


All Articles