CSS word-break Property

CSS word-break Property

May 25, 2019

The CSS word-break property specifies how words should break when reaching the end of a line.

Example:

<!DOCTYPE html>
<html>
   <head>
   
   </head>
   <body>
      <h2>word-break: normal (default):</h2>
      <p class="a">LoremIpsumissimplydummytextoftheprintingandtypesettingindustry.LoremIpsumhasbeentheindustry'sstandarddummytexteversincethe1500s,whenanunknownprintertookagalleyoftypeandscrambledittomakeatypespecimenbook.Ithas LoremIpsumissimplydummytextoftheprintingandtypesettingindustry.LoremIpsumhasbeentheindustry'sstandarddummytexteversincethe1500s,whenanunknownprintertookagalleyoftypeandscrambledittomakeatypespecimenbook.Ithas</p>
      <h2>word-break: keep-all:</h2>
      <p class="b">LoremIpsumissimplydummytextoftheprintingandtypesettingindustry.LoremIpsumhasbeentheindustry'sstandarddummytexteversincethe1500s,whenanunknownprintertookagalleyoftypeandscrambledittomakeatypespecimenbook.Ithas</p>
      <h2>word-break: break-all:</h2>
      <p class="c">LoremIpsumissimplydummytextoftheprintingandtypesettingindustry.LoremIpsumhasbeentheindustry'sstandarddummytexteversincethe1500s,whenanunknownprintertookagalleyoftypeandscrambledittomakeatypespecimenbook.Ithas</p>
   </body>
</html>
p { width: 140px; border: 1px solid #000000; } 
p.a { word-break: normal; } 
p.b { word-break: keep-all; } 
p.c { word-break: break-all; }

GitHub