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>
    <style>
        p {
            width: 140px;
            border: 1px solid #000000;
        }

        p.a {
            word-break: normal;
        }

        p.b {
            word-break: keep-all;
        }

        p.c {
            word-break: break-all;
        }
    </style>
</head>

<body>
    <h2>word-break: normal (default):</h2>
    <p class="a">
        LoremIpsumissimplydummytextoftheprintingandtypesettingindustry.
        LoremIpsumissimplydummytextoftheprintingandtypesettingindustry.
    </p>
    <h2>word-break: keep-all:</h2>
    <p class="b">
        LoremIpsumissimplydummytextoftheprintingandtypesettingindustry.
    </p>
    <h2>word-break: break-all:</h2>
    <p class="c">
        LoremIpsumissimplydummytextoftheprintingandtypesettingindustry.
    </p>
</body>

</html>

 

GitHub