Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://crydee.sai.msu.ru/~vab/html.doc/css2/text.html
Дата изменения: Tue May 12 12:30:02 1998 Дата индексирования: Tue Oct 2 01:09:39 2012 Кодировка: Поисковые слова: ngc 253 |
Contents
The properties defined in the following sections affect the visual presentation of characters, spaces, words, and paragraphs.
Value: | <length> | <percentage> | inherit |
Initial: | 0 |
Applies to: | block-level elements |
Inherited: | yes |
Percentages: | refer to width of containing block |
Media: | visual |
This property specifies the indentation of the first line of text in a block. More precisely, it specifies the indentation 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. User agents should render this indentation as blank space.
Values have the following meanings:
The value of 'text-indent' may be negative, but there may be implementation-specific limits.
The following example causes a '3em' text indent.
P { text-indent: 3em }
Value: | left | right | center | justify | <string> | inherit |
Initial: | depends on user agent and writing direction |
Applies to: | block-level elements |
Inherited: | yes |
Percentages: | N/A |
Media: | visual |
This property describes how inline content of a block is aligned. Values have the following meanings:
A block of text is a stack of line boxes. In the case of 'left', 'right' and 'center', this property 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 also 'letter-spacing' and 'word-spacing'.)
In this example, note that 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 }
Note. 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, respectively.
Value: | none | [ underline || overline || line-through || blink ] | inherit |
Initial: | none |
Applies to: | all elements |
Inherited: | no (see prose) |
Percentages: | N/A |
Media: | visual |
This property describes decorations that are added to the text of an element. If the property is specified for a block-level element, it affects all inline-level descendants of the element. If it is specified for (or affects) an inline-level element, it affects all boxes generated by the element. If the element has no content or no text content (e.g., the IMG element in HTML), user agents must ignore this property.
Values have the following meanings:
The color(s) required for the text decoration should be derived from the 'color' property value.
This property is not inherited, but 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.
In the following example for HTML, the text content of all A elements acting as hyperlinks will be underlined:
A[href] { text-decoration: underline }
This property accepts a comma-separated list of shadow effects to be applied to the text of the element. The shadow effects are applied in the order specified and may thus overlay each other, but they will never overlay the text itself. 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 itself.
Each shadow effect must specify a shadow offset and may optionally specify a blur radius and a shadow color.
A shadow offset is specified with two <length> values that indicate the distance from the text. The first length value specifies the horizontal distance to the right of the text. A negative horizontal length value places the shadow to the left of the text. The second length value specifies the vertical distance below the text. A negative vertical length value places the shadow above the text.
A blur radius may optionally be specified after the shadow offset. The blur radius is a length value that indicates the boundaries of the blur effect. The exact algorithm for computing the blur effect is not specified.
A color value may optionally be specified before or after the length values of the shadow effect. The color value will be used as the basis for the shadow effect. 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.
The example below will set a text shadow to the right and below the element's text. Since no color has been specified, the shadow will have the same color as the element itself, and since no blur radius is specified, the text shadow will not be blurred:
H1 { text-shadow: 0.2em 0.2em }
The next example will place a shadow to the right and below the element's text. The shadow will have a 5px blur radius and will be red.
H2 { text-shadow: 3px 3px 5px red }
The next example specifies a list of shadow effects. The first shadow will be to the right and below the element's text and will be red with no blurring. The second shadow will overlay the first shadow effect, and it will be yellow, blurred, and placed to the left and below the text. The third shadow effect will be placed to the right and above the text. Since no shadow color is specified for the third shadow effect, the value of the element's 'color' property will be used:
H2 { text-shadow: 3px 3px red, yellow -3px 3px 2px, 3px -3px }
Consider this example:
SPAN.glow { background: white; color: white; text-shadow: black 0px 0px 5px; }
Here, the 'background' and 'color' properties have the same value and the 'text-shadow' property is used to create a "solar eclipse" effect:
Note. This property is not defined in CSS1. Some shadow effects (such as the one in the last example) may render text invisible in UAs that only support CSS1.
Value: | normal | <length> | inherit |
Initial: | normal |
Applies to: | all elements |
Inherited: | yes |
Percentages: | N/A |
Media: | visual |
This property specifies spacing behavior between text characters. Values have the following meanings:
Character spacing algorithms are user agent-dependent. Character spacing may also be influenced by justification (see the 'text-align' property).
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'.
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:
Word spacing algorithms are user agent-dependent. Word spacing is also influenced by justification (see the 'text-align' property).
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 'normal'.
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:
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 'none' 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 }
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:
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.