How to keep overflow to only 1 line of text with CSS?

Spread the love

Sometimes, we want to keep overflow to only 1 line of text with CSS.

In this article, we’ll look at how to keep overflow to only 1 line of text with CSS.

How to keep overflow to only 1 line of text with CSS?

To keep overflow to only 1 line of text with CSS, we set the white-space property.

For instance, we write

div {
  white-space: nowrap;
}

to make the div’s contents stay in 1 row with white-space: nowrap;.

Conclusion

To keep overflow to only 1 line of text with CSS, we set the white-space property.

Leave a Reply

Your email address will not be published. Required fields are marked *