CSS 3 Font Effects
Search for: CSS 3 Font Effects
CSS Font StylesCSS Font Sizes
CSS Font Code
CSS Font Size Em
CSS Font List
CSS Font Shorthand
Font CSS Inline
CSS Text Decoration
‘avoid’
Line breaking is suppressed within the element: the UA may only break within the element if there are no other valid break points in the line. If the text breaks, line-breaking restrictions are honored as for ‘normal’.
Regardless of the ‘text-wrap’ value, lines always break at forced breaks: for all values, line-breaking behavior defined for the BK, CR, LF, CM NL, and SG line breaking classes in [UAX14] must be honored.
When ‘text-wrap’ is set to ‘normal’ or ‘avoid’, UAs that allow breaks at punctuation other than spaces should prioritize breakpoints. For example, if breaks after slashes have a lower priority than spaces, the sequence check etc will never break between the ‘ ’ and the ‘e’. The UA may use the width of the containing block, the text s language, and other factors in assigning priorities. As long as care is taken to avoid such awkward breaks, allowing breaks at appropriate punctuation other than spaces is recommended, as it results in more even-looking margins, particularly in narrow measures.
6. 1. 1. Phrase-controlled Breaking
Using ‘text-wrap: avoid’, the priority of breakpoints can be set to reflect the intended grouping of text.
Given the rules
footer { text-wrap: avoid; * inherits to all descendants * }
and the following markup:
27th Internationalization and Unicode Conference
• April 7, 2005 •
Berlin, Germany In a narrow window the footer could be broken as
27th Internationalization and Unicode Conference •
April 7, 2005 • Berlin, Germany
or in a narrower window as
27th Internationalization and Unicode
Conference • April 7, 2005 •
Berlin, Germany
but not as
27th Internationalization and Unicode Conference • April
7, 2005 • Berlin, Germany
6. 2. Emergency Wrapping: the ‘overflow-wrap’ property
Name: overflow-wrap
Value: normal | break-word
Initial: normal
Applies to: all elements
Inherited: yes
Percentages: N A
Media: visual
Computed value: specified value
This property specifies whether the UA may break within a word to prevent overflow when an otherwise-unbreakable string is too long to fit within the line box. It only has an effect when ‘text-wrap’ is either ‘normal’ or ‘avoid’. Possible values:
‘normal’
Lines may break only at allowed break points. However, the restrictions introduced by ‘word-break: keep-all’ may be relaxed to match ‘word-break: normal’ and the various hyphenation limit properties may be ignored if there are no otherwise-acceptable break points in the line.
‘break-word’
An unbreakable word may be broken at an arbitrary point if there are no otherwise-acceptable break points in the line. Shaping characters are still shaped as if the word were not broken, and grapheme clusters must together stay as one unit. No hyphenation character is inserted at the break point.
Break opportunities not part of ‘overflow-wrap: normal’ line breaking are not considered when calculating ‘min-content’ intrinsic sizes.
For legacy reasons, UAs may also accept ‘word-wrap’ as an alternate name for the ‘overflow-wrap’ property. However this syntax non-conforming in author style sheets.
7. Alignment and Justification
7. 1. Text Alignment: the ‘text-align’ property
Name: text-align
Value: [ [ start | end | left | right | center ] || ] | justify | match-parent | start end
Initial: start
Applies to: block containers
Inherited: yes
Percentages: N A
Media: visual
Computed value: specified value, except for ‘match-parent’ (see prose)
This property describes how inline contents of a block are aligned along the inline axis if the contents do not completely fill the line box. Values have the following meanings:
‘start’
The inline contents are aligned to the start edge of the line box.
‘end’
The inline contents are aligned to the end edge of the line box.
‘left’
The inline contents are aligned to the left edge of the line box. (In vertical writing modes, ‘left’ aligns to the edge of the line box that would be the start edge for left-to-right text. )
‘right’
The inline contents are aligned to the right edge of the line box. (In vertical writing modes, ‘right’ aligns to the edge of the line box that would be the end edge for left-to-right text. )
‘center’
The inline contents are centered within the line box.
‘justify’
The text is justified according to the method specified by the ‘text-justify’ property.
‘’
The string must be a single character; otherwise the declaration must be ignored. When applied to a table cell, specifies the alignment character around which the cell s contents will align. See below for further details and how this value combines with keywords.
‘match-parent’
This value behaves the same as ‘inherit’ except that an inherited ‘start’ or ‘end’ keyword is calculated against its parent s ‘direction’ value and results in a computed value of either ‘left’ or ‘right’.
‘start end’
Specifies ‘start’ alignment of the first line and any line immediately after a forced line break; and ‘end’ alignment of any remaining lines not affected by ‘text-align-last’.
A block of text is a stack of line boxes. In the case of ‘start’, ‘end’, ‘left’, ‘right’ and ‘center’, this property specifies how the inline-level boxes within each line box align with respect to the start and end sides of the line box: alignment is not with respect to the viewport or containing block.
In the case of ‘justify’, the UA may stretch or shrink any inline boxes by adjusting their text in addition to shifting their positions. (See also ‘text-justify’, ‘letter-spacing’, and ‘word-spacing’. ) If an element s white space is set to be collapsible, then the UA is not required to adjust its text for the purpose of justification and may instead treat the text as having no expansion opportunities. If the UA chooses to adjust the text, then it must ensure that tab stops continue to line up as required by the white space processing rules.
7. 1. 1. Character-based Alignment in a Table Column
When multiple cells in a column have an alignment character specified, the alignment character of each such cell in the column is centered along a single column-parallel axis and the rest of the text in the column shifted accordingly. (Note that the strings do not have to be the same for each cell, although they usually are. )
The following style sheet:
TD { text-align: . center }
will cause the column of dollar figures in the following HTML table:
Long distance calls
$1. 30
$2. 50
$10. 80
$111. 01
$85.
N A
$. 05
$. 06 to align along the decimal point. The table might be rendered as follows:
+---------------------+
| Long distance calls |
+---------------------+
| $11. 30 |
| $22. 50 |
| $0. 80 |
| $200567. 01 |
| $85. |
| N A |
| $. 05 |
| $. 06 |
+---------------------+
A keyword value may be specified in conjunction with the value; if it is not given, it defaults to ‘right’. This value is used:
when character-based alignment is applied to boxes that are not table cells.
when the text wraps to multiple lines (at unforced break points).
when a character-aligned cell spans more than one column. In this case the keyword alignment value is used to determine which column s axis to align with: the leftmost column for ‘left’, the rightmost column for ‘right’ and ‘center’, the startmost column for ‘start’, the endmost column for ‘end’.
when the column is wide enough that the character alignment alone does not determine the positions of its character-aligned contents. In this case the keyword alignment of the first cell in the column with a specified alignment character is used to slide the position of the character-aligned contents to match the keyword alignment insofar as possible without changing the width of the column. For ‘center’, the UA may center the aligned contents using its extremes, center the alignment axis itself (insofar as possible), or optically center the aligned contents some other way (such as by taking a weighted average of the extent of the cells contents to either side of the axis).
Right alignment is used by default for character-based alignment because numbering systems are almost all left-to-right even in right-to-left writing systems, and the primary use case of character-based alignment is for numerical alignment.
If the alignment character appears more than once in the text, the first instance is used for alignment. If the alignment character does not appear in a cell at all, the string is aligned as if the alignment character had been inserted at the end of its contents.
Character-based alignment occurs before table cell width computation so that auto width computations can leave enough space for alignment. Whether column-spanning cells participate in the alignment prior to or after width computation is undefined. If width constraints on the cell contents prevent full alignment throughout the column, the resulting alignment is undefined.
7. 2. Last Line Alignment: the ‘text-align-last’ property
Name: text-align-last
Value: auto | start | end | left | right | center | justify
Initial: auto
Applies to: block containers
Inherited: yes
Percentages: N A
Media: visual
Computed value: specified value
This property describes how the last line of a block or a line right before a forced line break is aligned. If a line is also the first line of the block or the first line after a forced line break, then, unless ‘text-align’ assigns an explicit first line alignment (via ‘start end’), ‘text-align-last’ takes precedence over ‘text-align’.
If ‘auto’ is specified, content on the affected line is aligned per ‘text-align’ unless ‘text-align’ is set to ‘justify’. In this case, content is justified if ‘text-justify’ is ‘distribute’ and start-aligned otherwise. All other values have the same meanings as in ‘text-align’.
7. 3. Justification Method: the ‘text-justify’ property
Name: text-justify
Value: auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida
Initial: auto
Applies to: block containers and, optionally, inline elements
Inherited: yes
Percentages: N A
Media: visual
Computed value: specified value
This property selects the justification method used when a line s alignment is set to ‘justify’ (see ‘text-align’), primarily by controlling which scripts characters are adjusted together or separately. The property applies to block containers, but the UA may (but is not required to) also support it on inline elements. It takes the following values:
‘auto’
The UA determines the justification algorithm to follow, based on a balance between performance and adequate presentation quality.
One possible algorithm is to determine the behavior based on the language of the paragraph: the UA can then choose appropriate value for the language, like ‘inter-ideograph’ for CJK, or ‘inter-word’ for English. Another possibility is to use a justification method that is a universal compromise for all scripts, e. g. the ‘inter-cluster’ method with block scripts raised to first priority.
‘none’
Justification is disabled. This value is intended for use in user stylesheets to improve readability or for accessibility purposes.
‘inter-word’
Justification primarily changes spacing at word separators. This value is typically used for languages that separate words using spaces, like English or Korean.
‘inter-ideograph’
Justification primarily changes spacing at word separators and between characters in block scripts. This value is typically used for CJK languages.
‘inter-cluster’
Justification primarily changes spacing at word separators and between characters in clustered scripts. This value is typically used for Southeast Asian scripts such as Thai.
‘distribute’
Justification primarily changes spacing both at word separators and between characters in all scripts equally (except those in the connected and cursive categories). This value is sometimes used in e. g. Japanese.
‘kashida’
Justification primarily stretches cursive scripts through the use of kashida or other calligraphic elongation. This value is optional for conformance to CSS3 Text. (UAs that do not support cursive elongation must treat the value as invalid. )
When justifying text, the user agent takes the remaining space between the ends of a line s contents and the edges of its line box, and distributes that space throughout its contents so that the contents exactly fill the line box. If the ‘letter-spacing’ and ‘word-spacing’ property values allow it, the user agent may also distribute negative space, putting more content on the line than would otherwise fit under normal spacing conditions. The exact justification algorithm is UA-dependent; however, CSS provides some general guidelines which should be followed when any justification method other than ‘auto’ is specified.
CSS defines expansion opportunities as points where the justification algorithm may alter spacing within the text. These expansion opportunities fall into priority levels as defined by the justification method. Within a line, expansion and compression should primarily target the first-priority expansion opportunities; lower priority expansion opportunities are adjusted at a lower priority as needed.
Expansion and compression limits are given by the letter-spacing and word-spacing properties. How any remaining space is distributed once all expansion opportunities reach their limits is up to the UA. If the inline contents of a line cannot be stretched to the full width of the line box, then they must be aligned as specified by the ‘text-align-last’ property. (If ‘text-align-last’ is ‘justify’, then they must be aligned as for ‘center’ if ‘text-justify’ is ‘distribute’ and as ‘start’ otherwise. )
The expansion opportunity priorities for values of ‘text-justify’ are given in the table below. Since justification behavior varies by writing system, expansion opportunities are organized by script categories. An expansion opportunity exists between two letters at a priority level when at least one of them belongs to a script category at that level and the other does not belong to a higher priority level. All scripts in the same priority level must be treated exactly the same. Word separators (spaces) and other symbols and punctuation are treated specially, see below. Prioritization of Expansion Points‘inter-word’ ‘inter-ideograph’ ‘distribute’ ‘inter-cluster’ ‘kashida’ ‘auto’
block 2 1 1 2 3 1*
clustered 2 2 1 1 3 1*
cursive 2 2 2 2 1 2*
discrete 2 2 1 2 3 2*
connected never never never never never never
spaces 1 1 1 1 2 1*
symbols 2 1 1 1 3 *
* The ‘auto’ column defined above is informative; it suggests a prioritization that presents a universal compromise among justification methods.
The spaces category represents expansion opportunities at word separators. (See ‘word-spacing’. ) Except when ‘text-justify’ is ‘distribute’, the UA may treat spaces differently than other expansion points in the same priority, but must not change their priority with respect to expansion points in other priority levels. For example, in Japanese ‘inter-ideograph’ justification (which treats CJK characters at a higher priority than Latin characters), word spaces traditionally have a higher priority than inter-CJK spacing, and the UA may split the 1st-priority level to implement that. However the UA is not allowed to drop spaces to the same priority as Latin characters.
The symbols category represents the expansion opportunities existing at or between any pair of characters from the Unicode Symbols (S*) and Punctuation (P*) classes. The default justification priority of these points is given above. However, there may be additional rules controlling their justification behavior due to typographic tradition. Therefore, the UA may reassign specific characters or introduce additional levels of prioritization to handle expansion opportunities involving symbols and punctuation. For example, there are traditionally no expansion opportunities between consecutive EM DASH U+2014, HORIZONTAL BAR U+2015, HORIZONTAL ELLIPSIS U+2026, or TWO DOT LEADER U+2025 characters [JLREQ]; thus a UA might assign these characters to the never prioritization level. As another example, certain fullwidth punctuation characters are considered to contain an expansion opportunity (see ‘text-spacing’). The UA might therefore assign these characters to a higher prioritization level than the opportunities between ideographic characters.
For justification of cursive scripts, words may be expanded through kashida elongation or other cursive expansion processes. Kashida may be applied in discrete units or continuously, and the prioritization of kashida points is UA-dependent: for example, the UA may apply more at the end of the line. The UA should not apply kashida to fonts for which it is inappropriate. It may instead rely on other justification methods that lengthen or shorten Arabic segments (e. g. by substituting in swash forms or optional ligatures). Because elongation rules depend on the typeface style, the UA should rely on on the font whenever possible rather than inserting kashida based on a font-independent ruleset. The UA should limit elongation so that, e. g. in multi-script lines a short stretch of Arabic will not be forced to soak up too much of the extra space by itself. If the UA does not support cursive elongation, then, as with connected scripts, no expansion points exist between characters of these scripts.
The UA may enable or break optional ligatures or use other font features such as alternate glyphs or glyph compression to help justify the text under any method. This behavior is not controlled by this level of CSS.
Add example of using ‘text-justify’ with the TeX algorithm.
3. 8 Line Adjustment in [JLREQ] gives an example of a set of rules for how a text formatter can justify Japanese text. It describes rules for cases where the ‘text-justify’ property is ‘inter-ideograph’ and the ‘text-spacing’ property does not specify ‘no-compress’.
It produces an effect similar to cases where the computed value of ‘text-spacing’ property does not specify ‘trim-end’ or ‘space-end’. If the UA wants to prohibit this behavior, rule b. of 3. 8. 3 should be omitted.
Note that the rules described in the document specifically target Japanese. Therefore they may produce non-optimal results when used to justify other languages such as English. To make the rules more applicable to other scripts, the UA could, for instance, omit the rule to compress half-width spaces (rule a. of 3. 8. 3).
8. Spacing
CSS offers control over text spacing via the ‘word-spacing’ and ‘letter-spacing’ properties. While in CSS1 and CSS2 these could only be ‘normal’ (justifiable) or a fixed length, CSS3 can indicate range constraints to control flexibility in justification. In addition the ‘word-spacing’ property can now be specified in percentages, making it possible to, for example, double or eliminate word spacing.
In the following example, word spacing is halved, but may expand up to its full amount if needed for text justification.
p { word-spacing: -50% 0%; }
The value type, which represents optimum, minimum, and maximum spacing in ‘word-spacing’ and ‘letter-spacing’, is defined as
= [ normal | | ]{1,3}
If three values are specified, they represent the optimum, minimum, and maximum in that order. If only two values are specified, then the first represents both the optimum and the minimum, and the second represents the maximum. If just one value is specified, then it represents the optimum, minimum, and maximum. The values are interpreted as defined below:
‘normal’
Specifies the normal optimum minimum maximum spacing, as defined by the current font and or the user agent. See below.
‘’
Specifies extra spacing in addition to the normal optimum spacing. Values may be negative, but there may be implementation-dependent limits.
‘’
Specifies the additional spacing as a percentage of the affected character. Only valid on ‘word-spacing’. Negative values are not allowed.
In the absence of justification the optimum spacing is be used. The text justification process may alter the spacing from its optimum (see the ‘text-justify’ property, above) but must not violate the minimum spacing limit and should also avoid exceeding the maximum.
The minimum is treated as a hard constraint: if the maximum is less than the minimum, then the used it is set to the minimum. Likewise for the optimum. Similarly if the maximum is less than the optimum, then the used optimum is set to the used maximum.
Normal spacing: Although ‘normal’ spacing is UA-defined, the normal minimum and maximum must be defined relative to the optimum so that the minimum and maximum limits increase and decrease with changes to the optimum spacing. These limits may also vary according to some measure of the amount of text on a line (e. g. block width divided by font size), as larger measures can accommodate tighter spacing constraints. Normal optimum minimum maximum spacing may also vary based on the value of the ‘text-justify’ property, the element s language, and other factors. Normal spacing between a pair of connected or cursive characters is always zero.
8. 1. Word Spacing: the ‘word-spacing’ property
Name: word-spacing
Value:
Initial: normal
Applies to: all elements
Inherited: yes
Percentages: refers to width of the affected glyph
Media: visual
Computed value: as specified, except with values computed to absolute lengths
This property specifies the minimum, maximum, and optimal spacing between “words”.
Additional spacing is applied to each word-separator character left in the text after the white space processing rules have been applied, and should be applied half on each side of the character.
The following example will make all the spaces between words in Arabic be rendered as zero-width, and double the width of each space in English:
:lang(ar) { word-spacing: -100%; }
:lang(en) { word-spacing: 100%; }
The following example will add half the the width of the “0” glyph to word spacing character [CSS3VAL]:
p { word-spacing: 0. 5ch; }
Word-separator characters include the space (U+0020), the no-break space (U+00A0), the Ethiopic word space (U+1361), the Aegean word separators (U+10100,U+10101), the Ugaritic word divider (U+1039F), and the Tibetan tsek (U+0F0B, U+0F0C). If there are no word-separator characters, or if the word-separating character has a zero advance width (such as the zero width space U+200B) then the user agent must not create an additional spacing between words. General punctuation and fixed-width spaces (such as U+3000 and U+2000 through U+200A) are not considered word-separator characters.
8. 2. Tracking: the ‘letter-spacing’ property
Name: letter-spacing
Value:
Initial: normal
Applies to: all elements
Inherited: yes
Percentages: N A
Media: visual
Computed value: as specified, except with values computed to absolute lengths
This property specifies the minimum, maximum, and optimal spacing between characters. Letter-spacing is applied in addition to any word-spacing. ‘normal’ optimum letter-spacing is typically zero.
Letter-spacing must not be applied at the beginning or at the end of a line. At element boundaries, the total letter spacing between two characters is given by and rendered within the innermost element that contains the boundary.
For the purpose of letter-spacing, each consecutive run of atomic inlines (such as image and or inline blocks) is treated as a single character.
For example, given the markup
abcdefg
and the style sheet
LS { letter-spacing: 1em; }
Z { letter-spacing: 0. 3em; }
Y { letter-spacing: 0. 4em; }
the spacing would be
a[0]b[1em]c[0. 3em]d[1em]e[0. 4em]f[0]g
UAs may apply letter-spacing to cursive scripts. In this case, UAs should extend the space between disjoint characters as specified above and extend the visible connection between cursively connected characters by the same amount (rather than leaving a gap). The UA may use glyph substitution or other font capabilities to spread out the letters. If the UA cannot expand a cursive script without breaking the cursive connections, it should not apply letter-spacing between characters of that script at all.
Letter-spacing ignores zero-width characters (such as those from the Unicode Cf category). For example, ‘letter-spacing’ applied to A&zwsp;B is identical to AB.
When the resulting space between two characters is not the same as the default space, user agents should not use optional ligatures.
9. Edge Effects
Edge effects control the indentation of lines with respect to other lines in the block (‘text-indent’) and how content is aligned to the start and end edges of a line (‘hanging-punctuation’).
9. 1. First Line Indentation: the ‘text-indent’ property
Name: text-indent
Value: [ | ] && [ hanging || each-line ]?
Initial: 0
Applies to: block containers
Inherited: yes
Percentages: refers to width of containing block
Media: visual
Computed value: the percentage as specified or the absolute length, plus any keywords as specified
This property specifies the indentation applied to lines of inline content in a block. The indent is treated as a margin applied to the start edge of the line box. Unless otherwise specified via the ‘each-line’ and or ‘hanging’ keywords, only lines that are the first formatted line of an element are affected. For example, the first line of an anonymous block box is only affected if it is the first child of its parent element.
Values have the following meanings:
‘’
Gives the amount of the indent as an absolute length.
‘’
Gives the amount of the indent as a percentage of the containing block s logical width.
‘each-line’
Indentation affects the first line of the block container as well as each line after a forced line break, but does not affect lines after a text wrap break.
‘hanging’
Inverts which lines are affected.
If ‘text-align’ is ‘start’ and ‘text-indent’ is ‘5em’ in left-to-right text with no floats present, then first line of text will start 5em into the block:
Since CSS1 it has been possible
to indent the first line of a block
element using the text-indent
property.
Note that since the ‘text-indent’ property inherits, when specified on a block element, it will affect descendant inline-block elements. For this reason, it is often wise to specify ‘text-indent: 0’ on elements that are specified ‘display: inline-block’.
9. 2. Hanging Punctuation: the ‘hanging-punctuation’ property
Name: hanging-punctuation
Value: none | [ first || [ force-end | allow-end ] || last ]
Initial: none
Applies to: inline elements
Inherited: yes
Percentages: N A
Media: visual
Computed value: as specified
This property determines whether a punctuation mark, if one is present, may be placed outside the line box (or in the indent) at the start or at the end of a line of text.
Note that if there is not sufficient padding on the block container, hanging punctuation can trigger overflow.
Values have the following meanings:
‘none’
No characters can hang.
‘first’
An opening bracket or quote at the start of the first formatted line of an element hangs. This applies to all characters in the Unicode categories Ps, Pf, Pi.
‘last’
A closing bracket or quote at the end of the last formatted line of an element hangs. This applies to all characters in the Unicode categories Pe, Pf, Pi.
‘force-end’
A stop or comma at the end of a line hangs.
‘allow-end’
A stop or comma at the end of a line hangs if it does not otherwise fit prior to justification.
When a punctuation mark hangs, it is not considered when measuring the line s contents for fit, alignment, or justification. Depending on the line s alignment, this can push the mark outside the line box. At most one punctuation character may hang outside each edge of the line.
A hanging punctuation mark is still enclosed inside its inline box and participates in text justification: its character advance width is just not measured when determining how much content fits on the line, how much the line s contents need to be expanded or compressed for justification, or how to position the content within the line box for text alignment.
Non-zero start and end borders or padding on an inline box are not allowed to hang. This can prevent a hangable punctuation mark from hanging: for example, a period at the end of an inline box with end padding cannot hang outside the end edge of a line.
Stops and commas allowed to hang include: U+002C , COMMA
U+002E . FULL STOP
U+060C ? ARABIC COMMA
U+06D4 ? ARABIC FULL STOP
U+3001 ? IDEOGRAPHIC COMMA
U+3002 ? IDEOGRAPHIC FULL STOP
U+FF0C , FULLWIDTH COMMA
U+FF0E . FULLWIDTH FULL STOP
U+FE50 ? SMALL COMMA
U+FE51 ? SMALL IDEOGRAPHIC COMMA
U+FE52 ? SMALL FULL STOP
U+FF61 ? HALFWIDTH IDEOGRAPHIC FULL STOP
U+FF64 ? HALFWIDTH IDEOGRAPHIC COMMA
The UA may include other characters as appropriate.
The CSS Working Group would appreciate if UAs including other characters would inform the working group of such additions.
Support for this property is optional. It is recommended for UAs that wish to support CJK typography, particularly those in the Japanese market.
The ‘allow-end’ and ‘force-end’ are two variations of hanging punctuation used in East Asia.
p {
hanging-punctuation: allow-end;
}
p {
hanging-punctuation: force-end;
}
The punctuation at the end of the first line for ‘allow-end’ does not hang, because it fits without hanging. However, if ‘force-end’ is used, it is forced to hang. The justification measures the line without the hanging punctuation. Therefore the line is expanded.
10. Text Decoration
10. 1. Line Decoration: Underline, Overline, and Strike-Through
The following properties describe line decorations that are added to the content of an element. When specified on or propagated to an inline box, such decoration affects all the boxes generated by that element, and is further propagated to any in-flow block-level boxes that split the inline (see CSS2. 1 section 9. 2. 1. 1) When specified on or propagated to a ruby box, the decorations are further propagated only to the ruby base. When specified on or propagated to a a block container that establishes an inline formatting context, the decorations are propagated to an anonymous inline element that wraps all the in-flow inline-level children of the block container. For all other elements, the decorations are propagated to any in-flow children.
Note that text decorations are not propagated to any out-of-flow descendants, nor to the contents of atomic inline-level descendants such as inline blocks and inline tables.
By default underlines, overlines, and line-throughs are applied only to text (including white space, letter spacing, and word spacing): margins, borders, and padding are skipped. Elements containing no text, such as images, are likewise not decorated. The ‘text-decoration-skip’ property can be used to modify this behavior, for example allowing inline replaced elements to be underlined or requiring that white space be skipped.
In determining the position and thickness of text decoration lines, user agents may consider the font sizes and dominant baselines of descendants, but for a given element s decoration must use the same position and thickness throughout each line box. The color and line style of decorations must remain the same on all decorations applied by a given element, even if descendant elements have different color or line style values.
The following figure shows the averaging for underline:
In the three fragments of underlined text, the underline is drawn consecutively lower and thicker as the ratio of large text to small text increases.
Relatively positioning a descendant moves all text decorations affecting it along with the descendant s text; it does not affect calculation of the decoration s initial position on that line. The ‘visibility’ property, filters, and other graphical transformations likewise affect text decorations as part of the text they re drawn on, even if the decorations were specified on an ancestor element. Does this include ‘text-shadow’? What about text-fill etc. ?
In the following style sheet and document fragment:
blockquote { text-decoration: underline; color: blue; }
em { display: block; }
cite { color: fuchsia; }
Help, help!
I am under a hat!
—GwieF . . . the underlining for the blockquote element is propagated to an anonymous inline element that surrounds the span element, causing the text Help, help! to be blue, with the blue underlining from the anonymous inline underneath it, the color being taken from the blockquote element. The text in the em block is also underlined, as it is in an in-flow block to which the underline is propagated. The final line of text is fuchsia, but the underline underneath it is still the blue underline from the anonymous inline element.
This diagram shows the boxes involved in the example above. The rounded aqua line represents the anonymous inline element wrapping the inline contents of the paragraph element, the rounded blue line represents the span element, and the orange lines represent the blocks.
10. 1. 1. Text Decoration Lines: the ‘text-decoration-line’ property
Name: text-decoration-line
Value: none | [ underline || overline || line-through ]
Initial: none
Applies to: all elements
Inherited: no (but see prose)
Percentages: N A
Media: visual
Computed value: as specified
Specifies what line decorations, if any, are added to the element. Values have the following meanings:
‘none’
Neither produces nor inhibits text decoration.
‘underline’
Each line of text is underlined.
‘overline’
Each line of text has a line above it (i. e. on the opposite side from an underline).
‘line-through’
Each line of text has a line through the middle.
10. 1. 2. Text Decoration Color: the ‘text-decoration-color’ property
Name: text-decoration-color
Value:
Initial: currentColor
Applies to: all elements
Inherited: no
Percentages: N A
Media: visual
Computed value: the computed color
This property specifies the color of text decoration (underlines overlines, and line-throughs) set on the element with ‘text-decoration-line’.
10. 1. 3. Text Decoration Style: the ‘text-decoration-style’ property
Name: text-decoration-style
Value: solid | double | dotted | dashed | wavy
Initial: solid
Applies to: all elements
Inherited: no
Percentages: N A
Media: visual
Computed value: as specified
This property specifies the style of the line(s) drawn for text decoration specified on the element. Values have the same meaning as for the border-style properties [CSS3BG]. ‘wavy’ indicates a wavy line.
10. 1. 4. Text Decoration Shorthand: the ‘text-decoration’ property
Name: text-decoration
Value: || || || blink
Initial: none
Applies to: all elements
Inherited: no
Percentages: N A
Media: visual
CSS Font Styles
CSS Font Sizes
CSS Font Code
CSS Font Size Em
CSS Font List
CSS Font Shorthand
Font CSS Inline
CSS Text Decoration
Search for: CSS 3 Font Effects
Not My Mothers Kitchen Gia Vi Nau Pho