Computer >> Computer tutorials >  >> Programming >> CSS

CSS hyphens Property


The hyphens property is used to specify how words are to be hyphenated when text wraps across multiple lines. It has the following values −

hyphens: none|manual|auto|initial|inherit;

Example

<!DOCTYPE html>
<html>
<head>
<style>
div {
   width: 50px;
   border: 2px dashed red;
}
.demo {
   -webkit-hyphens: manual;
   -ms-hyphens: manual;
   hyphens: manual;
}
</style>
</head>
<body>
<h1>Demo Heading</h1>
<h2>hyphens: manual property value</h2>
<div class="demo">This is a demo text.</div>
</body>
</html>

Output

CSS hyphens Property

Example

Let us now see another example −

<!DOCTYPE html>
<html>
<head>
<style>
div {
   width: 50px;
   border: 2px dashed red;
   color: blue;
}
.demo {
   -webkit-hyphens: auto;
   -ms-hyphens: auto;
   hyphens: auto;
}
</style>
</head>
<body>
<h1>Demo Heading</h1>
<h2>hyphens: auto property value</h2>
<div class="demo">This isssssss a demo text.</div>
</body>
</html>

Output

CSS hyphens Property