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

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

From: Kenneth Kin Lum <kenneth.kin.lum@gmail.com>
Date: Sat, 29 Mar 2008 12:37:52 -0700
Message-ID: <d8b3b8e80803291237o72333290y51a9445075019580@mail.gmail.com>
To: public-html-comments@w3.org
I have tested the following in IE 7.0.6001.18000, Firefox 2.0.0.13, Safari
3.1, and Opera 9.26

<div>hello world</div>

<div> hello world </div>

<div><span> hello world </span></div>

<div><span>
       hello world
</span></div>

The final rendering in all the modern browsers are the same.
And the same is true for the following:

<h1>hello world</h1>
<h1> hello world </h1>
<h1><span> hello world </span></h1>

<p>hello world</p>
<p> hello world </p>
<p><span>  hello world  </span></p>


There is a common rule -- maybe it is de facto -- that is not addressed in
the HTML 4.01 or 5.0 spec: any white space BEFORE AND AFTER any concrete
content is IGNORED. (or, any space after the beginning tag or before the
ending tag is ignored.) NOTE THAT IT IS NOT COLLAPSED. IT IS TOTALLY
IGNORED. At first I thought it happens only inside a block element but not
inline, but it actually happens in both.

And that's why designers count on this fact and use

<div>
    <div>
            ...
    </div>
<div>

because some of them know that spaces and newline in front of the second
<div> is totally IGNORED.  Since it is so widely use, can the HTML 5 spec
include this rule that everybody relies upon?
Content is important, but space is important too, as space separates
contents and affects final render results.  So can the spec be not so
ambitguous and be more specific about spaces.

I am aware that in http://www.w3.org/TR/html401/struct/text.html
it is said that

"This specification does not indicate the behavior, rendering or otherwise,
of space characters other than those explicitly identified here as white
space characters. For this reason, authors should use appropriate elements
and styles to achieve visual formatting effects that involve white space,
rather than space characters."

But the fact that practically all designers rely on the fact that those
space is totally ignored and not a single space is rendered, it can make
sense to put it into the spec or the recommendation.

Best,
Kin
Received on Sunday, 30 March 2008 03:21:31 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 1 June 2011 00:13:58 GMT