W3C home > Mailing lists > Public > public-html-comments@w3.org > March 2008

Re: HTML 4.01 and 5.0: is it somewhat "unspecific" about space characters

From: Daniel Beardsmore <resident@telcontar.net>
Date: Mon, 31 Mar 2008 09:24:14 +0100
Message-ID: <47F09FAE.8070509@telcontar.net>
To: public-html-comments@w3.org

> It does feel a little different from the idea that HTML is the "content"
> and CSS is the "presentation", because if CSS decides whether the white
> spaces that an author put in the HTML file get rendered or not, then it
> seems like the CSS is deciding on what the content is too, as whitespace
> characters can also be considered part of the content.

For example, you can write:

  .codeblock {
   display: block;
   margin: 0.7em 2em;
   white-space: pre;


  <code class="codeblock">This is some code that's being shown
in a pre-spaced block, but semantically marked
as being code</code>

For starters, it would be nice if the white-space: pre didn't force you to
lose line breaks; I wish this worked:

  <code class="codeblock">
This is some code that's being shown
in a pre-spaced block, but semantically marked
as being code

Now, in Firefox, if you copy that text and paste it into another
application, you get it all on one line. Firefox treats white-space: pre as
*presentational* meaning that it should be copied and pasted as if it were
regular text.

The ActiveState Perl documentation is like this -- you can't copy and paste
code samples because the white space has somehow ended up presentational. I
seem to recall that Internet Explorer obeys the white-space: pre and copies
the text as if it were a <pre> block. I'd have to make a test page and check
which browsers do what.

Certainly though, there's disagreement in HTML 4/CSS 2 implementations as to
who's controlling the space -- HTML or CSS. If you set space behaviour with
CSS, then you're robbing the HTML of correctness: the document's fundamental
layout is being lost and you're relying on presentation to put it back.
Something like Lynx for example won't deal with <code class="codeblock">
because it has no idea what CSS is.

Some presentation is content (white space, quotation mark control, using CSS
counters to conveniently number headings etc), some presentation is icing
sugar (background images, table borders etc). HTML/CSS doesn't do very well
at differentiating the two. And you can't reference colour in the text, if
CSS is providing the colour ...
Received on Monday, 31 March 2008 08:27:02 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:26:24 UTC