Categories
CSS Web development

CSS word-spacing Property

Learn how to use the CSS word-spacing Property.



CSS word-spacing Property

The CSS word-spacing property increases or decreases the white space between words.

Demo:

Syntax:

word-spacing: normal|length;

normal (default) – specifies normal space between words (0.25em).

length – specifies an additional space between words (in px, cm, etc). Read more about length units here.

Example:

<!DOCTYPE html>
<html>
<head>
<style>
.ex-1 { 
  word-spacing: normal;
}

.ex-2 { 
  word-spacing: 35px;
}

.ex-3 { 
  word-spacing: 1.2cm;
}
</style>
</head>
<body>

<h4>word-spacing: normal;</h4>
<p class="ex-1">This is a paragraph.</p>

<h4>word-spacing: 35px;</h4>
<p class="ex-2">This is a paragraph.</p>

<h4>word-spacing: 1cm;</h4>
<p class="ex-3">This is a paragraph.</p>

</body>
</html>

Output:

word-spacing: normal;

This is a paragraph.

word-spacing: 35px;

This is a paragraph.

word-spacing: 1cm;

This is a paragraph.


Enjoy coding!

Read also:

CSS letter-spacing Property

CSS line-height Property

CSS text-align Property