CSS3 Text: white-space processing

CSS3 White-Space Processing

(based on Ian Hickson's original text, modified through discussion)

For each inline (including anonymous inlines), the following steps are
performed, ignoring bidi formatting characters as if they were not
  1. Each non-linefeed whitespace character is treated as per the
     'white-space-treatment' property.
  2. If 'all-space-treatment' 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.
  3. Each linefeed character is treated as per the 'linefeed-treatment'
  4. If 'all-space-treatment' is set to 'collapse',
       1. every tab (U+0009) is converted to a space (U+0020)
       2. any space (U+0020) following another space (U+0020)--even
          a space before the inline, if that space also has
          'all-space-treatment' set to collapse--is removed.

Then, the entire block is rendered. Inlines are laid out, taking bidi
reordering into account, and wrapping as specified by the 'wrap-option',
'line-break' and 'word-break' properties.

As each line is laid out,
  1. If a space (U+0020) at the beginning of a line has 'all-space-
     treatment' set to 'collapse', it is removed.
  2. All tabs (U+0009) are rendered as a horizontal shift that lines
     up the start edge of the next glyph with the next tab stop. Tab
     stops occur at points that are mutiples of 8 times the width of
     a space (U+0020) rendered in the block's font from the block's
     starting content edge.
  3. If a space (U+0020) at the end of a line has 'all-space-
     treatment' set to 'collapse', it is also removed.


- tab stops line up in the block regardless of font changes
- pre-wrap text can break at whitespace, but whitespace is preserved
- auto-transformed linefeeds are still break points

Received on Wednesday, 18 December 2002 08:19:46 UTC