[Standards-JIG] XHTML further simplification

Byron Ellacott bje at apnic.net
Tue Sep 21 05:27:56 UTC 2004


Ian Paterson wrote:
> The idea of a recommended stylesheet for XHTML-IM is interesting.
> However, I don't think it should include the 'white-space: pre' property.
> According to the CSS1 spec "UAs may ignore the 'white-space' property". Many
> CSS renderers do not support it (including the one built into Windows XP
> that many client implementations will rely on).

It almost certainly shouldn't.  Not only do some[0] CSS renderers not 
support it, but 'white-space: pre' doesn't just mean to preserve 
whitespace, it also means that the content should not be broken to fill 
a box, which means small displays will have to horizontally scroll, or 
large displays will have a tiny column of text, or both.

> I really think we should avoid any form of 'pre' if we can. Are there any
> strong reasons NOT to use <br/> and  ?

The CSS2.1 spec is actually quite clear on what the property means:

(From http://www.w3.org/TR/CSS21/text.html#white-space-prop)
  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.

  2. If 'white-space' is set to 'pre' or 'pre-wrap', 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.

These two together make it fairly clear to me that <br/> and   are 
perfectly acceptable replacements for 'white-space: pre' newlines and 
spaces, while still allowing renderers to break lines to fill boxes.

(Thus the only reason to want a <pre> or 'white-space: pre' like 
behaviour is to prevent automatic line breaking.  If that behaviour is 
desirable, it should be filled by <pre>, for the reasons you already gave.)

-- 
bje

[0] The meaning of "some" here depends on whether you count by vendor or 
count by use.  CSS2 renderers must support the 'white-space' property, 
but the MS renderer is not a CSS2 renderer.



More information about the Standards mailing list