What is CSS word-wrap Property?

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.

New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources