Word Spacing using CSS

CSSWeb DevelopmentFront End Technology

To set spacing between words, use the word-spacing property. The property values are as follows −

word-spacing: normal|length|initial|inherit;

Example

Let us now see an example −

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
p.demo1 {
   word-spacing: normal;
}
p.demo2 {
   word-spacing: 10px;
}
</style>
</head>
<body>
<h1>Demo Heading</h1>
<h2>Heading2</h2>
<p class="demo1">This is demo text.</p>
<h2>Heading2</h2>
<p class="demo2">This is demo text.</p>
</body>
</html>

Output

Example

Let us now see another example −

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
p.demo1 {
   word-spacing: 3cm;
}
p.demo2 {
   word-spacing: 40px;
}
</style>
</head>
<body>
<h1>Demo Heading</h1>
<h2>Heading2</h2>
<p class="demo1">This is demo text.</p>
<h2>Heading2</h2>
<p class="demo2">This is demo text.</p>
</body>
</html>

Output

raja
Published on 30-Dec-2019 10:40:51
Advertisements