16 Text

affects the visual presentation of characters, spaces, words, and paragraphs.

16.1 Indentation

text-indent
: <length> | <percentage> | inherited

Initial:0 ; Applies to: block-level elements ; Percentages:refer to width of containing block

Specifies the indentation of the first line of text in a block. of the first box that flows into the block's first line box. The box is indented with respect to the left (or right, for right-to-left layout) edge of the line box. Rendered as blank space.

signed <length>
The indentation is a fixed length.
<percentage>
The indentation is a percentage of the containing block width.

text-indent may be negative, but there may be implementation-specific limits.

This example should cause a '10em' text indent.

  P { text-indent: 10em ;font-family:monospace}
<div style=text-indent:10em;font-family:monospace>
This applies only at the beginning of the paragraph!!
When text wrapping occurs the second line
in the paragraph is not indented.
<p style=text-indent:-10em;font-family:monospace>
This applies only at the beginning of the paragraph!!
When text wrapping occurs
the second line in the
paragraph is not indented.
</p> occures here
<p>
<p>
some more after the </p> starts to indent at the <div> setting <div>
012345678 012345678 012345678
This applies only at the beginning of the paragraph!! When text wrapping occurs the second line in the paragraph is not indented.

This applies only at the beginning of the paragraph!! When text wrapping occurs the second line in the paragraph is not indented.
</p> occures here

some more after the </p> starts to indent at the <div> setting

16.2 Alignment

text-align:
left | right | center | justify | <string> | inherit
Applies to: block-level elements
Inherited

Describes how inline content of a block is aligned.

<string>
Specifies a string on which cells in a table column will align (see horizontal alignment in a column ). applies only to table cells.
on other elements, treated as left or right, depending on whether direction is ltr, or rtl, .

A block of text is a stack of line boxes.
In the case of left, right and center, this specifies how the inline boxes within each line box align with respect to the line box's left and right sides; alignment is not with respect to the viewport.
In the case of justify the UA may stretch the inline boxes in addition to adjusting their positions. (See letter-spacing and word-spacing.)

Example(s):

In this example, since text-align is inherited, all block-level elements inside the DIV element with class=center will have their inline content centered.

DIV.center { text-align: center }

The actual justification algorithm used is user-agent and written language dependent.

Conforming user agents may interpret the value justify as left or right depending on whether the element's default writing direction is left-to-right or right-to-left.

16.3 Decoration

16.3.1 Underlining, overlining, striking, and blinking

text-decoration :none | [ underline || overline || line-through || blink ] | inherit
Applies to: all elements , not Inherited
Specified for a block-level element affects all inline-level descendants of the element.
Specified for (or affects) an inline-level element, affects all boxes generated by the element.
If the element has no content or no text content (e.g., IMG ), user agents must ignore this property.

blink alternates between visible and invisible Conforming user agents are not required to support this value.

Colors should be derived from the color property value.

Not inherited, descendant boxes of a block box should be formatted with the same decoration (e.g., they should all be underlined).
The color of decorations should remain the same even if descendant elements have different color values.

Example(s):

In the following example for HTML, the text content of all A elements acting as hyperlinks will be underlined:

A[href] { text-decoration: underline }

16.3.2 Text shadows

I cannot find any browser that implements this!

text-shadow :none | [ <color> ||
right below radius? ,]* lt;color> ||
right<length> below<length> radius<length>?] |
inherit

Applies to:all elements ; not Inherited

Comma-separated list of shadow effects to be applied to the text of the element, in the order specified and may overlay, but will never overlay the text .
Shadow effects do not alter the size of a box, but may extend beyond its boundaries.
The stack level of the shadow effects is the same as for the element .

Each shadow effect must specify shadow offsets and may specify a blur radius and a shadow color.

A shadow offset is specified with two <length> signed values that indicate the distance from the text.
The first length value specifies the horizontal distance to the right of the text, negative values to the left of the text.
The second length value specifies the vertical distance below the text, negative value above the text.
An optional blur radius indicates the boundaries of the blur effect. The exact algorithm for computing the blur effect is not specified.
If no color is specified, the value of the color property will be used instead.

Text shadows may be used with the :first-letter and :first-line pseudo-elements.

A text shadow to the right and below the element's text, no color has been specified, the shadow will have the same color as the element , and no blur radius is specified, the text shadow will not be blurred:

<span style=font-size:300%;text-shadow:5px 5px ;color:navy>shadowed<span>
shadowed
or not

16.4 Letter and word spacing

letter-spacing
Value: normal | <length> | inherit
Initial: normal
Applies to: all elements ; Inherited

Specifies spacing behavior between text characters.

normal
The spacing is the normal spacing for the current font. This value allows the user agent to alter the space between characters in order to justify text.
<length>
inter-character space in addition to the default space between characters. Values may be negative, but there may be implementation-specific limits. User agents may not further increase or decrease the inter-character space in order to justify text.

Character spacing algorithms are user agent-dependent. Character spacing may also be influenced by justification (see text-align ).

In this example, the space between characters in BLOCKQUOTE elements is increased by '0.1em'.

BLOCKQUOTE { letter-spacing: 0.1em }

In the following example, the user agent is not permitted to alter inter-character space:

BLOCKQUOTE { letter-spacing: 0cm }   /* Same as '0' */

When the resultant space between two characters is not the same as the default space, user agents should not use ligatures.

Conforming user agents may consider the value of the letter-spacing property to be normal

word-spacing
Value:  normal | <length> | inherit
Initial:  normal
Applies to:  all elements
Inherited:  yes
Percentages:  N/A
Media:  visual

This property specifies spacing behavior between words. Values have the following meanings:

normal
The normal inter-word space, as defined by the current font and/or the UA.
<length>
This value indicates inter-word space in addition to the default space between words. Values may be negative, but there may be implementation-specific limits.

Word spacing algorithms are user agent-dependent. Word spacing is also influenced by justification (see the text-align property).

Example(s):

In this example, the word-spacing between each word in H1 elements is increased by '1em'.

H1 { word-spacing: 1em }

Conforming user agents may consider the value of the word-spacing property to be <

16.5 Capitalization: the text-transform property

text-transform
Value:  capitalize | uppercase | lowercase | none | inherit
Initial:  none
Applies to:  all elements
Inherited:  yes
Percentages:  N/A
Media:  visual

This property controls capitalization effects of an element's text. Values have the following meanings:

capitalize
Puts the first character of each word in uppercase.
uppercase
Puts all characters of each word in uppercase.
lowercase
Puts all characters of each word in lowercase.
none
No capitalization effects.

The actual transformation in each case is written language dependent. See RFC 2070 ([RFC2070]) for ways to find the language of an element.

Conforming user agents may consider the value of text-transform to be < for characters that are not from the Latin-1 repertoire and for elements in languages for which the transformation is different from that specified by the case-conversion tables of ISO 10646 ( [ISO10646]).

In this example, all text in an H1 element is transformed to uppercase text.

H1 { text-transform: uppercase }

16.6 Whitespace: the white-space property

white-space
Value:  normal | pre | nowrap | inherit
Initial:  normal
Applies to:  block-level elements
Inherited:  yes
Percentages:  N/A
Media:  visual

This property declares how whitespace inside the element is handled. Values have the following meanings:

normal
This value directs user agents to collapse sequences of whitespace, and break lines as necessary to fill line boxes. Additional line breaks may be created by occurrences of "\A" in generated content (e.g., for the BR element in HTML).
pre
This value prevents user agents from collapsing sequences of whitespace. Lines are only broken at newlines in the source, or at occurrences of "\A" in generated content.
nowrap
This value collapses whitespace as for < but suppresses line breaks within text except for those created by "\A" in generated content (e.g., for the BR element in HTML).

Example(s):

The following examples show what whitespace behavior is expected from the PRE and P elements, and the "nowrap" attribute in HTML.

PRE        { white-space: pre }
P          { white-space: normal }
TD[nowrap] { white-space: nowrap }

Conforming user agents may ignore the white-space property in author and user style sheets but must specify a value for it in the default style sheet.