CSS Word-Spacing Property



CSS Tutorial  >  Text  >  Word-spacing

The word-spacing property specifies the amount of space between two words. Possible values for this property are as follows:

  • "normal": this is the default value, which is 0.25em.
  • a length: This is a numerical value plus a length unit, and indicates the distance in relation to the default distance. A positive number means that there is more space between words. A negative number means there is less space between words.

Several examples are shown below:

Example 1: Positive word-spacing value

CSS Declaration

p {
  word-spacing: 8px;
}

The following HTML,

<p>8px added to the default distance between words.</p>

renders

8px added to the default distance between words.

In Example 1, the positive word-spacing value results in extra white space between words.

Example 2: Negative word-spacing value

CSS Declaration

p {
  word-spacing: -0.25em;
}

The following HTML,

<p>-0.25em subtracted from the default distance between words.</p>

renders

-0.25em subtracted from the default distance between words.

In Example 2, we set word-spacing to be -0.25em. Given that the default value is 0.25em, this means we are leaving no space between words, and this is indeed what we see above: the entire sentence looks like a long single word.

Next: CSS Float




Copyright © 2024   1keydata.com   All Rights Reserved   Privacy Policy   About   Contact

AdBlock Detected!

Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.