Text Alignment Controls
To align your text on the page or adjust the spacing or your words and letters you use the following stylesheet attributes.
- word-spacing specifies how big a gap to leave between words. A default value of normal will apply if you don't specify a length for the gap.
- letter-spacing specifies how big a gap to leave between letters. A default value of normal will apply if you don't specify a length for the gap.
- vertical-align specifies where to align the text vertically relative to the adjacent text or container. Possible values are baseline (the default), a percentage, sub (subscript), super (superscript), top, text-top, middle, bottom or text-bottom. A percentage or length can also be specified. This attribute can only be set for inline tags.
- line-height defaults to normal. You can also specify a number, length, or percentage.
- text-align specifies where to align the text horizontally relative to the adjacent text or container. Possible values are left (the default), right, center or justify. This attribute can only be set for block tags.
- text-indent defines how far to indent the first line of a block of text. You can specify a length or percentage.
- white-space defines how whitespace will be treated. normal (the default) reduces each section of whitespace to a single space, pre retains all of the whitespace, and nowrap stops the content from wrapping to a new line.
Length can be specified in a number of different ways:
- em width of letter M in current font
- ex width of letter x in current font
- cm centimetres
- mm millimetres
- pc picas
- pt points
- in inches
- px pixels
Examples
p{text-indent:40px;text-align:justify;}
.stretch {letter-spacing: 10px;}



