<div class="container">
<h3>Lines break/wrap as they normally do, long words overflow their container</h3>
<div class="text">
<strong>pneumonoultramicroscopicsilicovolcanoconiosis</strong> refers to a lung disease contracted from the inhalation of very fine silica particles,[8] specifically from a volcano;
</div>
</div>
<div class="container">
<h3>Only overflowing words break using word-wrap/overflow-wrap</h3>
<div class="text text-1">
<strong>pneumonoultramicroscopicsilicovolcanoconiosis</strong> refers to a lung disease contracted from the inhalation of very fine silica particles,[8] specifically from a volcano;
</div>
</div>
<div class="container">
<h3>Both overflowing (long) words and words at end of lines break to fit lines</h3>
<div class="text text-2">
<strong>pneumonoultramicroscopicsilicovolcanoconiosis</strong> refers to a lung disease contracted from the inhalation of very fine silica particles,[8] specifically <strong>from</strong> a volcano. </div>
</div>
body {
background-color: #F5F5F5;
color: #555;
font-size: 1.1em;
line-height: 1.5;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.container {
margin: 50px auto;
max-width: 700px;
}
.text {
padding: 20px;
background-color: #0099cc;
color: white;
width: 300px;
margin: 30px auto;
text-align: justify;
/* box-sizing: border-box;*/
}
.text-1 {
word-wrap: break-word;
/* added this just to show that word-wrap has precedence over word-break */
word-break: keep-all;
}
.text-2 {
/* breaking words using word-break will also break words that would break using word-wrap */
word-break: break-all;
}
strong {
background-color: #006699;
}