CSS Word Wrap

Google Advertisements

Prev Tutorial Next Tutorial

CSS Word Wrap

CSS Word Wrap properties are used for break the long words and wrap onto the next line. The main use of this properties is to prevent overflow when a long string unable to fit into containing box.

CSS word wrap values

ValueDescription
normalThis property is used to break words only at allowed break points.
break-wordIt is used to break unbreakable words.
initialIt sets this property to its default value.
inheritIt inherits this property from its parent element.

Example without using word-break

In below example we understand what happen when we do not use word-break. Larger word will be display out side the box area

Example

<!DOCTYPE html>  
<html>  
<head>  
<style>  
p.box {  
    width: 140px;  
    background: cyan;   
    border: 1px solid #000000;  
    padding:10px;  
} 
</style>  
</head>  
<body>  
<p class="box">This is my first html with css code. Now i am happyyyyyyyyyyyyyyyyyyy. How are you friendssssssssssssssssss?</p>  
</body>  
</html>

Result

This is my first html with css code. Now i am happyyyyyyyyyyyyyyyyyyy. How are you friendssssssssssssssssss?.

Example using word-break

Example

<!DOCTYPE html>  
<html>  
<head>  
<style>  
p.box {  
    width: 140px;  
    background: cyan;   
    border: 1px solid #000000;  
    padding:10px;  
    word-wrap: break-word;  
} 
</style>  
</head>  
<body>  
<p class="box">This is my first html with css code. Now i am happyyyyyyyyyyyyyyyyyyy. How are you friendssssssssssssssssss?</p>  
</body>  
</html>

Result

This is my first html with css code. Now i am happyyyyyyyyyyyyyyyyyyy. How are you friendssssssssssssssssss?.

Browser supported

Properties
word-wrapYesYesYesYesYes

Prev Tutorial Next Tutorial

Google Advertisements

Buy This Ad Space @$50 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 8076671483

Pure VPN Privide Lowest Price VPN Just @ $1.65. Per Month with Non Detected IP Lowest Price Non Detected IP VPN

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

Cloud computing is the on demand availability of computer system resources, especially data storage and computing power, without direct active management by the user. Cloud Computing Tutorial

College Projects Related to Java, AWT, C Projects for College, C++ Projects for College, Android Projects. Download Java C C++ Projects

Download Projects

Adsense Advertisements


Buy This ads Space 8076671483

Buy This Ad Space @$120 per Month, Ad Size 300X600 Contact on: hitesh.xc@gmail.com or 8076671483 Try this Keyword C++ Programs