CSS wordwrap Property (original) (raw)

CSS word-wrap Property

Last Updated : 11 Jul, 2025

The word-wrap property in CSS is used to manage the breaking and wrapping of long words within an element, ensuring that the content fits within its container. This property is essential for maintaining readability and layout integrity when dealing with lengthy words or strings without spaces.

**Syntax

word-wrap: normal|break-word|initial|inherit;

**Property Value

Value Description
normal Default value; lines can only be broken at normal break points (spaces, non-alphanumeric characters).
break-word Words that exceed the width of the container will be arbitrarily broken to fit within the bounds.
initial Sets the word-wrap property to its default value.
inherit Inherits the property from its parent.

Example: Using word-wrap: normal

This example demonstrates the default behavior where words only break at normal break points.

**Example: In the example, word-wrap: normal; ensures text in the

breaks only at spaces or punctuation, not within words, causing overflow beyond the container's 150px width.

html `

word-wrap property
<style>
    div {
        word-wrap: normal;
        width: 150px;
        border: 1px solid black;
    }
</style>
GeeksforGeeks:AComputerSciencePortalForGeeks

`

**Output: word wrapExample: Using word-wrap: break-word

This example shows how words exceeding the container's width are broken to fit within the bounds.

**Example: In this example, the word-wrap: break-word; allows the text in the

to break arbitrarily within words to fit within the 150px width container.

html `

word-wrap property
<style>
    div {
        word-wrap: break-word;
        width: 150px;
        border: 1px solid black;
    }
</style>
GeeksforGeeks:AComputerSciencePortalForGeeks

`

**Output:

word wrap

By using the word-wrap property, you can control how long words are handled in your layouts, ensuring that content remains within its container and maintaining a clean, readable presentation.

**Supported Browsers: The browser supported by _word-wrap property are listed below: