HTML Cookbook Basic HTML Course

It's Easy!


Alternate Version

Word Spacing

Just as CSS can be used to change the spacing between letters, it can also be used to change the spacing between words with the word-spacing property.


Declaration Form

The form for the word-spacing decalration is:
word-spaing: value

The possible values are normal or length.

length may be expressed in the same units we have used in other lessons, such as px, pt or cm. Percentage (%) is not supported.

Length values may be positive or negative. Positive values move words apart. Negative values move words closer together. Normal is the same as 0 (zero). In other words, the value you use will add to or subtract from the normal distance between words.


Styling for word-spacing

Word-spacing can be used in a style statement or as a class.

Sample Stylesheet
/* word-spacing */
.near { word-spacing: -4px; }
.far { word-spacing: 30px; }
.overlap {word-spacing: -1em }


Sample Code
<p class="far">
These words are spread apart.
</p>

<p class="near">
These words are close together.
</p>

<p class="overlap">
These words overlap.
</p>


Appears as:

These words are spread apart.

These words are close together.

These words overlap.

PC Screenshot (white page)
PC Screenshot (black page)


WebTV Limitation

WebTV (MSNTV) does not support word-spacing.

WebTV Solutions

Positive values for word-spacing can simulated:


Assignment

Contemplate the meaning of life.

Happy coding!
Gnubee

Links
Tips
Tools
References
Rules
HTML Help Gnubee - Newsgroup
HTML Course Contents (Home)

Valid XHTML 1.0!

Valid CSS!