How to word-wrap long words in a div with CSS?

Spread the love

Sometimes, we want to word-wrap long words in a div with CSS.

In this article, we’ll look at how to word-wrap long words in a div with CSS.

How to word-wrap long words in a div with CSS?

To word-wrap long words in a div with CSS, we set the white-space property.

For instance, we write

.wordwrap {
  white-space: pre-wrap;
}

to add white-space: pre-wrap; to word-wrap long words in a div.

Conclusion

To word-wrap long words in a div with CSS, we set the white-space property.

Leave a Reply

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