Is the CSS 'white-space' property supposed to be able to affect the
whitespace between block elements?
For example, in the document used as an example in "[Whitespace in the
DOM][1]" as follows, there is whitespace between the `</h1>` and the
`<p>`:
<!-- My document -->
<html>
<head>
<title>My Document</title>
</head>
<body>
<h1>Header</h1>
<p>
Paragraph
</p>
</body>
</html>
This whitespace is normally removed; for example, [the XHTML spec says
that a conforming user agent must meet all of the following
criteria][2]:
> In elements where the 'xml:space'
> attribute is set to 'preserve', the
> user agent must leave all whitespace
> characters intact (with the exception
> of leading and trailing whitespace
> characters, which should be removed).
> Otherwise, whitespace is handled
> according to the following rules:
>
> * All whitespace surrounding block elements should be removed.
> * Leading and trailing whitespace inside a block element must be
> removed.
> * Line feed characters within a block element must be converted into a space
> (except when the 'xml:space' attribute
> is set to 'preserve').
> * A sequence of white space characters must be reduced to a single space
> character (except when the 'xml:space'
> attribute is set to 'preserve').
My questions are as follows:
* If I use the [CSS white-space property][3] on the `<body>`, should
this be able to preserve the whitespace between block elements (e.g.
between the `</h1>` and the `<p>`)? Or is whitespace between blocks
always removed, with the white-space property only affecting
whitespace within blocks?
* The XHTML spec says that a `<body>` [cannot directly contain
PCDATA][4] (i.e. text). Does that mean that whitespace (being a kind
of text) that's a direct child of the `<body>` tag is always
insignificant/ignored, and cannot be enabled via CSS? If yes and
whitespace between the `</h1>` and the `<p>` in the above example were
ignored because it's a direct child of the `<body>`, would/should that
whitespace still be ignored if there were a `<div style="white-space:
pre">` immediately within the `<body>` and enclosing all the other
elements?
* [The 'white-space' processing model][5] starts with, "Any text that
is directly contained inside a block element (not inside an inline
element) should be treated as an anonymous inline element". What
should I understand about pure whitespace (whitespace with no text)?
* Is there a rule (and if so, where is this rule defined) about
removing whitespace within inline elements? For example in the
following sequence `<p>The <strong> lazy </strong> dog.</p>` should
the whitespace after the `<strong>` tag be removed? (The HTML 4 spec
has [a rule about this for line breaks][6]; I was wondering whether
this rule also applied to other, non-line-beak whitespace, and whether
this rule is mentioned/defined/allowed/assumed in any XHTML or CSS
specification.)
I'm more interested in what I'm supposed to understand from the
(present and/or future CSS and/or HTML and/or XHTML) specs than I am
in knowing how well if at all the various browser versions implement
those specs.
[1]: https://developer.mozilla.org/en/whitespace_in_the_dom
[2]:
http://www.w3.org/TR/2000/WD-xhtml-modularization-20000105/conformance.html#s_conform_user_agent
[3]: http://www.w3.org/TR/CSS2/text.html#white-space-prop
[4]:
http://www.w3.org/TR/2001/REC-xhtml-modularization-20010410/abstract_modules.html#s_structuremodule
[5]: http://www.w3.org/TR/CSS2/text.html#white-space-model
[6]: http://www.w3.org/TR/html401/appendix/notes.html#notes-line-breaks
______________________________________________________________________
css-discuss [[email protected]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/