W3C home > Mailing lists > Public > www-html@w3.org > January 2010

Re: Inconsistency in HTML 4.01 regarding NBSP

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Fri, 15 Jan 2010 21:25:43 +0200
Message-ID: <EF278181ADD14066B6672B6E99FC59FA@JukanPC>
To: "Andrey V. Lukyanov" <land@long.yar.ru>, <www-html@w3.org>
Andrey V. Lukyanov wrote:

>>> 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. <<
>
> It means that behavior and rendering of no-break space are undefined,
> and that no-break spaces are not recommended for use in HTML
> documents.

The statements you quoted are apparently clear and simple, but indeed they 
say something that they apparently were not meant to say. They are probably 
meant to say that authors should not use fixed-width space characters, 
expecting some consistent rendering. The real reason to avoid fixed-width 
spaces is that many fonts lack them and browsers may be unable to render 
them for this reason.

The no-break space is a different beast, but the statements could be read as 
saying that you should not expect any specific handling, such as treating 
no-break space as non-collapsible (or collapsible) with adjacent no-break 
space characters or white space characters or as non-stretchable or 
non-shrinkable when rendering text as justified on both sides. (In practice, 
no-break spaces are normally non-collapsible, non-stretchable, and 
non-shrinkable.)

>>> Sometimes authors may want to prevent a line break from occurring
> between two words. The &nbsp; entity (&#160; or &#xA0;) acts as a
> space where user agents should not cause a line break. <<
>
> This paragraph directly recommends the use of no-break spaces.

Yes, more or less. Oddly enough it recommends the use of an entity reference 
or a character reference without even mentioning that it can be entered as 
such as a character, if the document's character encoding allows that, as it 
usually does. So it creates some mysticism around "entities".

> To avoid ambiguity, Section 9.1 (White space) should explicitly state
> that, although no-break space (&#x00A0;) is not white space, it is
> rendered exactly like an ASCII space except that no line break is
> permitted between words separated by a no-break space.

Nobody will do anything to HTML 4.01 anymore, sadly enough.

Browsers do not necessarily (or usually) treat no-break space simply as a 
non-breaking variant of the space character, and they don't really need to.

There's typically an essential rendering difference between <p> </p> and 
<p>&nbsp;</p> as well as between <td> </td> and <td>&nbsp;</td> when borders 
or backgrounds are involved.

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/ 
Received on Friday, 15 January 2010 19:26:33 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:16:17 GMT