Open In App

CSS word-wrap Property

The word-wrap property in CSS is used to break long words and wrap them 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:



Example: In this example, we are using word-wrap: normal; property.




<!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>

Output:

  

Example: In this example, we are using word-wrap: break-word property.




<!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>

Output:

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


Article Tags :