Copyright © 2007 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark and document use rules apply.
This CSS3 module defines properties for text manipulation and specifies their processing model. It covers line breaking, justification and alignment, white space handling, text decoration and text transformation.
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.
This Text module and a separate (upcoming) Text Layout module replace and obsolete the May 2003 CSS3 Text Module Candidate Recommendation. Since this is a thorough overhaul of the previous version, a list of changes has been provided instead of a diff.
This document is a Working Draft, and it is still very incomplete. In fact, many of its sections have not been added in.
Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
Feedback on this draft should be posted to the (archived) public mailing list www-style@w3.org (see instructions) with [CSS3 Text] in the subject line. You are strongly encouraged to complain if you see something stupid in this draft. I will do my best to respond to all feedback.
If you have implemented properties from CSS3 Text CR please let me know so I can take that into account as I redraft the spec. You can post to www-style (public), post to the CSS WG mailing list (Member-restricted), or email fantasai directly (personal).
This CSS module has been produced as a combined effort of the W3C Internationalization Activity, and the Style Activity and is maintained by the CSS Working Group. It also includes contributions made by participants in the XSL Working Group (members only). This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
The following features are at risk and may be cut from the spec during
its CR period: multiple text shadows, the tibetan
text
justification mode, the 'text-outline' property, the 'break-strict'
value of 'word-break'
[document here]
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 (see [RFC2119]). However, for readability, these words do not typically appear in all uppercase letters in this specification.
Additional key words, e.g. "User agent (UA)", are defined by CSS 2.1 ([CSS21], section 3.1).
UAs must treat as invalid any properties or values they do not support. Experimental implementations of a feature should support only a vendor-prefixed syntax for the property/value.
White space processing in CSS interprets white space characters for rendering: it has no effect on the underlying document data. In the context of CSS, the document white space set is defined to be any space characters (Unicode value U+0020), tab characters (U+0009), or line break characters (defined by the document format: typically line feed, U+000A). Control characters besides the white space characters and the bidi formatting characters (U+202x) are treated as normal characters and rendered according to the same rules.
The document parser must normalize line break character sequences according to its own format rules before CSS processing takes effect. However, in generated content strings the line feed character (U+000A) and only the line feed character is considered a line break sequence. For CSS white space processing all line breaks must be normalized to a single character representation—usually the line feed character (U+000A)—here called a "line break". This way, all recognized line breaks are treated the same and style rules behave consistently across systems.
Note that the document parser may have not only normalized line break characters, but also collapsed other space characters or otherwise processed white space according to markup rules. Because CSS processing occurs after the parsing stage, it is not possible to restore these characters for styling. Therefore, some of the behavior specified below can be affected by these limitations and may be user agent dependent.
This section is still under discussion and may change in future drafts.
Name: | white-space-collapse |
---|---|
Value: | preserve | collapse | preserve-breaks | discard |
Initial: | collapse |
Applies to: | all elements |
Inherited: | yes |
Percentages: | N/A |
Media: | visual |
Computed value: | specified value |
This property declares whether and how white space inside the element is collapsed. Values have the following meanings, which must be interpreted according to the white space processing rules:
collapse
preserve
preserve-breaks
discard
Any text that is directly contained inside a block (not inside an inline) is treated as being inside an anonymous inline element.
For each inline (including anonymous inlines), white space characters are handled as follows, ignoring bidi formatting characters as if they were not there:
If 'white-space-collapse' is set to 'collapse' or 'preserve-breaks', white space characters are considered collapsible and are processed by performing the following steps:
If 'white-space-collapse' is set to 'preserve', any sequence of spaces (U+0020) unbroken by an element boundary is treated as a sequence of non-breaking spaces. However, a line breaking opportunity exists at the end of the sequence.
If 'white-space-collapse' is set to 'discard', the first white space character in every white space sequence is converted to a zero width non-joiner (U+200C) and the rest of the sequence is removed.
Then, the entire block is rendered. Inlines are laid out, taking bidi reordering into account, and wrapping as specified by the 'text-wrap' property.
As each line is laid out,
Consider the following markup fragment, taking special note of spaces (with varied backgrounds and borders for emphasis and identification):
<ltr>A <rtl> B </rtl> C</ltr>
where the <ltr>
element represents a left-to-right
embedding and the <rtl>
element represents a
right-to-left embedding. If the 'white-space-collapse' property is set
to 'collapse', the above processing model would result in the
following:
This would leave two spaces, one after the A in the left-to-right embedding level, and one after the B in the right-to-left embedding level. This is then ordered according to the Unicode bidirectional algorithm, with the end result being:
A BC
Note that there are two spaces between A and B, and none between B and C. This is best avoided by putting spaces outside the element instead of just inside the opening and closing tags and, where practical, by relying on implicit bidirectionality instead of explicit embedding levels.
When line breaks are collapsible, they are either transformed into a space (U+0020) or removed depending on the script context before and after the line break.
The script context is determined by the Unicode-given script value [UAX24] of the first character that side of the line break. However, characters such as punctuation that belong to the COMMON and INHERITED scripts are ignored in this check; the next character is examined instead. The UA must not examine characters outside the block and may limit its examination to as few as four characters on each side of the line break. If the check fails to find an acceptable script value (i.e. it has hit the check limits), then the script context is neutral.
Comments on how well this would work in practice would be very much appreciated, particularly from people who work with Thai and similar scripts.
Name: | white-space |
---|---|
Value: | normal | pre | nowrap | pre-wrap | pre-line |
Initial: | not defined for shorthand properties |
Applies to: | all elements |
Inherited: | yes |
Percentages: | N/A |
Media: | visual |
Computed value: | see individual properties |
The 'white-space' property is a shorthand for the 'white-space-collapse' and 'text-wrap' properties. Not all combinations are represented. Values have the following meanings:
normal
pre
nowrap
pre-wrap
pre-line
The following informative table summarizes the behavior of various 'white-space' values:
New Lines | Spaces and Tabs | Text Wrapping | |
---|---|---|---|
normal | Collapse | Collapse | Wrap |
pre | Preserve | Preserve | No wrap |
nowrap | Collapse | Collapse | No wrap |
pre-wrap | Preserve | Preserve | Wrap |
pre-line | Preserve | Collapse | Wrap |
For most scripts, in the absence of hyphenation a line break occurs only at word boundaries. Many writing systems use spaces or punctuation to explicitly separate words, and line break opportunities can be identified by these characters. Scripts such as Thai, Lao, and Khmer, however, do not use spaces or punctuation to separate words. Although the zero width space (U+200B) can be used as an explicit word delimiter in these scripts, this practice is not common. As a result, a lexical resource is needed to correctly identify break points in such texts.
In several other writing systems, (including Chinese, Japanese, Yi, and sometimes also Korean) a line break opportunities are based on syllable boundaries, not words. In these systems a line can break anywhere except between certain character combinations. Additionally the level of strictness in these restrictions can vary with the typesetting style.
CSS distinguishes between two levels of strictness in the rules for implicit line breaking in CJK text. The precise set of rules in effect for the strict and loose levels is up to the UA and should follow language conventions. However, this specification does recommend that the following breaks be forbidden in strict line breaking and allowed in loose:
Breaks between Hangul syllable blocks are allowed in both strict and loose rules: to restrict breaks in Korean to spaces, the 'keep-all' value of 'word-break' can be specified.
Information on line breaking conventions can be found in [JIS4051] for Japanese, [标点符号] for Chinese, and [?] for Korean, and in [UAX14] for all scripts in Unicode.
Any guidance for appropriate references here would be much appreciated.
Name: | word-break |
---|---|
Value: | normal | keep-all | loose | break-strict | break-all |
Initial: | normal |
Applies to: | all elements |
Inherited: | yes |
Percentages: | N/A |
Media: | visual |
Computed value: | specified value |
This property specifies what set of line breaking restrictions are in effect within the element. Values have the following meanings:
normal
keep-all
loose
break-strict
break-all
When shaping scripts such as Arabic are allowed to break within words due to 'break-all' or 'break-strict', the characters must still be shaped as if the word were not broken.
The definition of the hyphenation feature is very much up-in-the-air at the moment. The WG plans to discuss it at our next face-to-face meeting at the end of March. Comments and suggestions for consideration are welcome.
Some of the syntax proposals so far are to
A current proposal for advanced hyphenation controls is published in the Generated Content for Paged Media draft.
If hyphenation is applied to a shaped script such as Arabic then the shaping process must ignore the hyphenation break and shape as if the word were still whole and unhyphenated.
Text wrapping is controlled by the 'text-wrap' and 'word-wrap' properties:
Name: | text-wrap |
---|---|
Value: | normal | unrestricted | none | suppress |
Initial: | normal |
Applies to: | all elements |
Inherited: | yes |
Percentages: | N/A |
Media: | visual |
Computed value: | specified value |
This property specifies the mode for text wrapping. Possible values:
normal
none
unrestricted
suppress
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 'suppress', UAs that allow breaks at punctutation 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.
The priority of breakpoints can be set to reflect the intended grouping of text.
Given the rules
footer { text-wrap: suppress; /* inherits to all descendants */ }
and the following markup:
<footer> <venue>27th Internationalization and Unicode Conference</venue> • <date>April 7, 2005</date> • <place>Berlin, Germany</place> </footer>
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
Name: | word-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 'suppress'. Possible values:
normal
break-word
Name: | text-align |
---|---|
Value: | start | end | left | right | center | justify | <string> |
Initial: | start |
Applies to: | all elements |
Inherited: | yes |
Percentages: | N/A |
Media: | visual |
Computed value: | specified value |
This property describes how inline contents of a block are horizontally aligned if the contents do not completely fill the line box. Values have the following meanings:
start
end
left
right
center
justify
<string>
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 boxes within each line box align within the line box: alignment is not with respect to the viewport or containing block. In the case of 'justify', the UA may stretch the inline boxes in addition to adjusting their positions. (See also the 'text-justify', 'text-justify-trim', 'text-kashida-space', 'letter-spacing' and 'word-spacing'.)
Name: | text-align-last |
---|---|
Value: | start | end | left | right | center | justify |
Initial: | start |
Applies to: | all elements |
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 when 'text-align' is set to 'justify'. Values have the same meaning as for 'text-align'.
Name: | text-justify |
---|---|
Value: | auto | inter-word | inter-ideograph | inter-cluster | distribute | kashida | tibetan |
Initial: | auto |
Applies to: | all elements |
Inherited: | yes |
Percentages: | N/A |
Media: | visual |
Computed value: | specified value |
This property selects the justification method used when 'text-align' is set to 'justify'. It takes the following values:
auto
inter-word
inter-ideograph
inter-cluster
distribute
kashida
tibetan
The 'tibetan' value of 'text-justify' will most likely be removed in the next draft, as inter-word justification is preferred in modern typesetting.
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.
Justification affects different types of writing systems in different ways. For justification purposes, writing systems are grouped as follows:
Where do scripts like Tamil fit in?
The UA may enable or break optional ligatures or use other font features such as alternate glyphs to help justify the text under any method. This behavior is not defined by CSS.
CSS defines expansion opportunities as points where the justification algorithm may alter spacing within the text. Expansion opportunities occur at word separators and between grapheme clusters. These expansion opportunities fall into priority levels as defined by the justification method. Within a line, higher priority expansion opportunities must be expanded or compressed to their limits before lower priority expansion opportunities may be adjusted. These 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 (or as 'start' if 'text-align-last' is 'justify').
The expansion opportunity priorities for values of 'text-justify' are given in the table below. Space must be distributed evenly among all types of expansion opportunities in a given prioritization group, but may vary within a line due to changes in the font or letter-spacing and word-spacing values. The different types of expansion opportunities are defined as follows:
I'm not sure grapheme clusters are the right unit to use for some of these complex scripts...
method: | inter-word | inter-ideograph | distribute | inter-cluster | kashida | tibetan | auto | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
priority: | 1st | 2nd | 1st | 2nd | 1st | 2nd | 1st | 2nd | 1st | 2nd | 3rd | 1st | 2nd | 3rd | - |
special | • | • | ? | ||||||||||||
spaces | • | • | • | • | • | • | |||||||||
discrete | • | • | • | • | • | • | |||||||||
block | • | • | • | • | • | • | |||||||||
clustered | • | • | • | • | • | • | |||||||||
connected | • | • | • | • | • | • | |||||||||
cursive | • | • | • | • | • | ||||||||||
tibetan | • | • | • | • | • | • |
The two values kashida
and tibetan
trigger
special justification behavior as specified below. This special behavior
takes priority over the expansion opportunity adjustments described
above.
The next two properties refer to the <spacing-limit> value type, which is defined as follows:
<spacing-limit>
normal
<length> or
<percentage>
Name: | word-spacing |
---|---|
Value: | <spacing-limit> {1,3} |
Initial: | normal |
Applies to: | all elements |
Inherited: | yes |
Percentages: | refers to width of space (U+0020) glyph |
Media: | visual |
Computed value: | 'normal' or computed value or percentage |
This property specifies the minimum, maximum, and optimal spacing between words. If only one value is specified, then it represents the optimal spacing and the minimum and maximum are both 'normal'. If two values are specified, then the first represents both the optimal spacing and the minimum spacing, and the second represents the maximum spacing. If three values are specified, they represent the optimum, minimum, and maximum respectively.
If the value of the optimum or maximum spacing is less than the value of the minimum spacing, then its used value is the minimum spacing. If the optimum spacing is greater than the maximum spacing then its used value is the maximum spacing. (This substitution occurs after inheritance.)
In the absence of justification the optimal spacing must 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.
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. This is correct for Ethiopian and doesn't matter for invisible spaces, but is it correct for Tibetan? Most publications seem to add space after the tsek mark during justification. Word-separator characters include the space (U+0020), the no-break space (U+00A0), the Ethiopic word space (U+1361), the ideographic space (U+3000), the Aegean word separators (U+10100,U+10101), the Ugaritic word divider (U+1039F), and the Tibetan tsek (U+0F0B, U+0F0C). Is this list correct? 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+2000 through U+200A) are not considered word-separators.
Name: | letter-spacing |
---|---|
Value: | <spacing-limit>{1,3} |
Initial: | normal |
Applies to: | all elements |
Inherited: | yes |
Percentages: | refers to width of space (U+0020) glyph |
Media: | visual |
Computed value: | 'normal' or computed value or percentage |
This property specifies the minimum, maximum, and optimal spacing between grapheme clusters. If only one value is specified, then it represents all three values. If two values are specified, then the first represents both the optimal spacing and the minimum spacing, and the second represents the maximum spacing. If three values are specified, they represent the optimum, minimum, and maximum respectively.
If the value of the optimum or maximum spacing is less than the value of the minimum spacing, then its used value is the minimum spacing. If the optimum spacing is greater than the maximum spacing then its used value is the maximum spacing. (This substitution occurs after inheritance.)
In the absence of justification the optimal spacing must 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. Letter-spacing is applied in addition to any word-spacing. 'normal' optimum letter-spacing is typically zero.
A grapheme cluster is what a language user considers to be a character or a basic unit of the script. The term is described in detail in the Unicode Technical Report: Text Boundaries [UAX29]. This specification relies on the default (not tailored) rules only.
Letter-spacing must not be applied at the beginning or at the end of a line. At element boundaries, the letter spacing is given by and rendered within the innermost element that contains the boundary.
For example, given the markup
<P>a<LS>b<Z>cd</Z><Y>ef</Y></LS>g</P>
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 graphemes as specified above and extend the visible connection between cursively connected graphemes 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 grapheme clusters of that script at all.
When the resulting space between two characters is not the same as the default space, user agents should not use optional ligatures.
Name: | punctuation-trim |
---|---|
Value: | none | [start || end || adjacent] |
Initial: | none |
Applies to: | all elements and generated content |
Inherited: | yes |
Percentages: | N/A |
Media: | visual |
Computed value: | specified value |
This property determines whether or not a fullwidth punctuation character should be trimmed (kerned) if it appears at the start or end of a line, or adjacent to another fullwidth punctuation character. Values are defined as follows:
The following example table lists the punctuation pairs affected by the 'adjacent' value. It uses halfwidth equivalents to approximate the trimming effect.
Combination | Sample Pair | Looks Like |
---|---|---|
Opening—Opening | 〔+( | 〔( |
Middle Dot—Opening | ・+( | ・( |
Closing—Opening | 〕+( | 〕( |
Ideographic Space—Opening | +( | ( |
Closing—Closing | )+〕 | )〕 |
Closing—Middle Dot | )+・ | )・ |
Closing—Ideographic Space | )+ | ) |
In the context of this property the following definitions apply:
Ps
) that belongs to the CJK Symbols and Punctuation
block (U+3000–U+303F) or is categorized as East Asian
Fullwidth (F) by [UAX11]. Also includes
LEFT SINGLE QUOTATION MARK (U+2018) and LEFT DOUBLE QUOTATION MARK
(U+201C).
When trimmed, the left (for horizontal text) or top (for vertical
text) half is kerned.Pe
) that belongs to the CJK Symbols and Punctuation
block (U+3000–U+303F) or is categorized as East Asian Fullwidth
(F) by [UAX11]. Also includes RIGHT SINGLE
QUOTATION MARK (U+2019) and RIGHT DOUBLE QUOTATION MARK (U+201D). May
also include fullwidth colon punctuation and/or fullwidth dot
punctuation (see below).
When trimmed, the right (for horizontal text) or bottom (for vertical
text) half is kerned.Fullwidth opening and closing punctuation must not be trimmed if the glyph is not actually fullwidth. A fullwidth glyph is one that has the same advance width as a typical Han character in the same font.
Whether fullwidth colon punctuation and fullwidth dot punctuation should be considered fullwidth closing punctuation or fullwidth middle dot punctuation depends on where in the glyph's box the punctuation is drawn. If the punctuation is centered, then it should be considered middle dot punctuation. If the punctuation is drawn to one side (left in horizontal text, top in vertical text) and the other half is therefore blank then the punctuation should be considered closing punctuation and trimmed accordingly.
The UA must classify fullwidth colon punctuation and fullwidth dot punctuation under either the fullwidth closing punctuation category or the fullwidth middle dot punctuation category as appropriate. The UA may rely on language conventions and the layout orientation (horizontal vs. vertical), and/or font information to determine this categorization. The UA may also add additional characters to any category as appropriate.
The following informative table summarizes language conventions for classifying fullwidth colon and dot punctuation:
colon punctuation | dot punctuation | |
---|---|---|
Simplified Chinese (horizontal) | closing | closing |
Simplified Chinese (vertical) | closing | closing |
Traditional Chinese | middle dot | middle dot |
Korean | middle dot | closing |
Japanese | middle dot | closing |
Note, that for Chinese fonts at least, the author observes that the standard convention is often not followed.
Paul and I have agreed that we want to simplify the set of properties introduced in the previous CSS3 Text Candidate Recommendation. We're not sure how yet, though, and would like to solicit input from the www-style community.
So far, we think that the following capabilities should be sufficient:
Here's one proposal:
Values: | none | [ underline || overline || line-through ] |
---|---|
Initial: | none |
Inherit: | no (but see prose) |
Values: | <color> |
---|---|
Initial: | currentcolor |
Inherit: | ? |
Values: | [ solid | double | dotted | dashed | dot-dash | dot-dot-dash | wave ] || thick |
---|---|
Initial: | solid |
Inherit: | ? |
Values: | none | [ images | spaces | ink ] |
---|---|
Initial: | images |
Inherit: | yes |
values | <'text-line-decoration'> || <'text-line-color'> || <'text-line-style'> || blink |
---|
Values: | auto | before-edge | alphabetic | after-edge |
---|---|
Initial: | auto |
Inherit: | yes |
Comments? Alternatives? Post them to www-style@w3.org with [CSS3 Text] in the subject line.
Name: | text-emphasis |
---|---|
Value: | none | [ [ accent | dot | circle | disc] [ before | after ]? ] |
Initial: | none |
Applies to: | all elements and generated content |
Inherited: | yes |
Percentages: | N/A |
Media: | visual |
Computed value: | as specified |
East Asian documents use small symbols on top of each glyph to emphasize a run of text. For example:
Accent emphasis (shown in blue for clarity) applied to Japanese text
This property applies emphasis formatting applied to text. Unlike 'text-decoration', emphasis marks can affect the line height. Values have the following meanings:
none
accent
dot
circle
disc
before
after
The list of shapes here is copied from the CSS3 Fonts module drafts, and it is not correct or at least not complete. Any input on what shapes are needed, what usage patterns are found in real texts, etc. would be much appreciated. Send them off to www-style@w3.org or www-international@w3.org with [CSS3 Text] in the subject line.
Note, the preferred position of emphasis marks depends on the language. In Japanese for example, the preferred position is 'before'. In Chinese used in the PRC, on the other hand, the preferred position is 'after'. The informative table below summarizes the preferred emphasis mark position for Chinese and Japanese:
Language | Preferred mark position | Illustration |
---|---|---|
Japanese | before | |
Chinese (Traditional) | before | |
Chinese (Simplified) | after |
Name: | text-shadow |
---|---|
Value: | none | [<shadow>, ] * <shadow> |
Initial: | none |
Applies to: | all elements and generated content |
Inherited: | yes |
Percentages: | N/A |
Media: | visual |
Computed value: | a color plus three absolute <length>s |
This property accepts a comma-separated list of shadow effects to
be applied to the text of the element. <shadow>
is defined as
[
<color>?
<length>
<length>
<length>?
|
<length>
<length>
<length>?
<color>?
]
,
where the first two lengths represent the offset and the third an
optional blur radius. The shadow is applied to all of the element's
text as well as any text decoration applied to it.
Would it be better to apply shadows together with
text decoration: i.e. a descendent of an underlined element doesn't
apply shadow to its underline, but the underlining element, if it has
shadows, would apply it to the underline of all text it underlines.
When a text outline is specified, the shadow
shadows the outlined shape rather than the glyph shape.
The shadow offset is specified with two <length> values that indicate an offset from direct alignment with 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. If the blur radius is not specified, it is equal to zero.
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 color of the shadow effect. If the color is not specified, a UA-chosen color will be used.
The shadow effects are applied in the order specified should this be changed to layer the same way multiple backgrounds do (earlier on top)? 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. Does this definition cause problems with the shadow of one element painting over the text of the previous element? How would we solve that?
Name: | text-outline |
---|---|
Value: | none | [ <color> <length> <length>? | <length> <length>? <color> ] |
Initial: | none |
Applies to: | all elements and generated content |
Inherited: | yes |
Percentages: | N/A |
Media: | visual |
Computed value: | a color plus two absolute <length>s |
This property specifies a text outline where the first length represents
the outline's thickness and the second represents an optional blur radius.
The outline never overlays the text itself. Its effect is the same as that
obtained by applying text shadows in every radial direction, i.e. all text
shadows whose offsets satisfy the equation
x2 + y2 = thickness2
.
The Timed-Text WG had suggestions for some keywords (text-outline: normal|heavy|light;) as well as a <length> thickness. Should these be added? How would they be defined? (Maybe use (thin|medium|thick) as in border-width?)
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, but it is only applied to the outer edge of the outline. If the blur radius is not specified, it is equal to zero. Is a second blur radius needed for the inner edge? Or should the blur apply to both edges? Implementations may choose to ignore the blur radius when text outline is combined with a text shadow.
A color value must be specified before or after the length values of the outline effect. The color value will be used as the color of the outline.
Name: | text-indent |
---|---|
Value: | [ <length> | <percentage> ] hanging? |
Initial: | 0 |
Applies to: | block-level, inline-block elements and table cells |
Inherited: | yes |
Percentages: | refers to width of containing block |
Media: | visual |
Computed value: | the percentage as specified or the absolute length |
This property specifies the indentation applied to lines of inline content in a block. The indendation only affects the first line of inline content in the block unless the 'hanging' keyword is specified, in which case it affects all lines except the first.
The indent is treated as a margin applied to the start edge of the line box. The amount of indentation is given by the length or percentage value. Percentages are relative to the containing block, even in the presence of floats. They are inherited as percentages, not as absolute lengths.
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 descendent inline-block elements. For this reason, it is often wise to specify 'text-indent: 0' on elements that are specified 'display: inline-block'.
Name: | hanging-punctuation |
---|---|
Value: | none | [ start || end || end-edge ] |
Initial: | none |
Applies to: | block-level, inline-block elements and table cells |
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 at the start or at the end of a full line of text. If a justified line can fit the punctuation will it expand to push it outside the content area? No. What if the line ends in multiple punctuation marks? Which punctuation marks are affected? Values have the following meanings:
start
end
end-edge
Need to work on the description. Cover indentation as well.
To be continued...
Much of the text has been rewritten or severely revised, so all changes will not be listed here. Highlights include:
Many sections intended for this module are not yet represented in this draft. In particular, the 'text-justify-trim', 'text-overflow', 'text-decoration', 'text-transformation', 'text-autospace', other properties have not yet been evaulated.
Sections relating to text layout (vertical text, grids, 'text-combine') will be moved to a separate Text Layout module. These features may change greatly from the last revision, but they have not been dropped. The vertical text feature, for example, will likely be based on the methods described in Unicode Technical Note #22.
This specification would not have been possible without the help from: Ayman Aldahleh, Bert Bos, Tantek Çelik, Stephen Deach, Martin Dürst, Laurie Anna Edlund, Ben Errez, Yaniv Feinberg, Arye Gittelman, Ian Hickson, Martin Heijdra, Richard Ishida, Koji Ishii, Masayasu Ishikawa, Michael Jochimsen, Eric LeVine, Chris Lilley, Shinyu Murakami, Paul Nelson, Chris Pratley, Martin Sawicki, Rahul Sonnad, Frank Tang, Chris Thrasher, Etan Wexler, Chris Wilson, Masafumi Yabe and Steve Zilles.