HTML and CSS Reference
In-Depth Information
Increasing or Decreasing the Space Between Letters
he
letter-spacing
property controls the amount of horizontal space between letters. In print terminology, this
is known as
tracking
. The property accepts the following values:
normal
This is the default. It allows the browser to adjust the space between
characters to justify text. Setting
letter-spacing
explicitly to
normal
cancels any
inherited value.
Use a length value with a unit of measurement to specify how much space to add or
subtract from the normal spacing between characters. The
em
unit is particularly useful
because it's directly proportional to the font size.
Figure
4-7
demonstrates the effect of this property in
letter-spacing.html
. The first heading is displayed as
normal. In the second,
letter-spacing
has been set to
0.2em
. And the final one uses
-0.1em
.
Figure 4-7.
Even a small amount of letter-spacing makes a big difference to the look of text
Controlling the Space Between Words
Computers have no concept of what constitutes a word, but the
word-spacing
property adjusts the width of the
space character. You use it in exactly the same way as
letter-spacing
.
■
The CSS3 Text module proposes a space-separated list of up to three values for
letter-spacing
and
word-spacing
. One value represents the optimum, minimum, and maximum spacing. With two values, the first rep-
resents the optimum and minimum spacing, and the second represents the maximum. if three values are given, they
represent optimum, minimum, and maximum respectively. Fine tuning like this is likely to be useful for fully justified
text. no browser currently supports multiple values for
letter-spacing
and
word-spacing
.
Note
Aligning Text Horizontally
Horizontal alignment is controlled by the
text-align
property. It accepts the following values:
left
Align text to the left, and leave ragged ends on the right.
right
Align text to the right, and leave ragged ends on the left.