Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Web Technology by (40.7k points)

Okay, this is really confusing me. I have some content inside of a div like so:

<div style="background-color: green; width: 200px; height: 300px;">

Thisisatest.Thisisatest.Thisisatest.Thisisatest.Thisisatest.Thisisatest.

</div>

However, the content overflows the DIV (as expected) because the 'word' is too long.

How can I force the browser to 'break' the word where necessary to fit all of the content inside?

1 Answer

0 votes
by (40.7k points)

Try using word-break as follows:

[word-break: break-word;]

Browse Categories

...