CSS | word-wrap Property

The word-wrap property in CSS is used to break long word and wrap into the next line. It defines whether to break words when the content exceeds the boundaries of its container.

Syntax:

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

Property Value:

  • normal: It is the default value, The lines can only be broken at normal break points (spaces, non-alphanumeric characters, etc.).

    Syntax:

    word-wrap: normal;

    Example:



    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
        <head>
            <title>
                word-wrap property
            </title>
              
            <style>
                div {
                    word-wrap:normal;
                    width: 150px; 
                    border: 1px solid black;
                }
            </style>
        </head>
          
        <body>
            <div>
                GeeksforGeeks:AComputerSciencePortalForGeeks
            </div>
          
        </body>
    </html>                    

    chevron_right

    
    

    Output:
    word wrap

  • break-word: Words that exceed the width of the container will be arbitrarily broken to fit within the container’s bounds.

    Syntax:

    word-wrap: break-word;

    Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
        <head>
            <title>
                word-wrap property
            </title>
              
            <style>
                div {
                    word-wrap:break-word;
                    width: 150px; 
                    border: 1px solid black;
                }
            </style>
        </head>
          
        <body>
            <div>
                GeeksforGeeks:AComputerSciencePortalForGeeks
            </div>
          
        </body>
    </html>                    

    chevron_right

    
    

    word wrap

  • initial: It is used to set word-wrap property to its default value.
  • inherit: This property is inherited from its parent.

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

  • Google Chrome 4.0
  • Internet Explore 5.5
  • Firefox 3.5
  • Safari 3.1
  • Opera 10.5


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.