What is CSS word-wrap Property?

Share

We constantly have unbreakable strings such as long words when developing our website, and by default, these strings will overflow its container in the inline direction if it’s too small for it.

Let’s have a look at an example given below:

Without word-wrap

One of the way to correct this is using the word-wrap property. The word-wrap property allows you to force the text to wrap - even if it means splitting it in the middle of a word.

The word-wrap is used with the value break-word. So the syntax is:

word-wrap:break-word;

Let’s have a look at an example with word-wrap given below:

word-wrap:break-word

The long words break and wrap to the next line, and there is no inline overflow.