W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2014

[whatwg] HTML spec incorrectly suggests that <br> can have its rendering changed with CSS

From: Daniel Holbert <dholbert@mozilla.com>
Date: Wed, 22 Jan 2014 13:51:40 -0800
Message-ID: <52E03D6C.6090406@mozilla.com>
To: WHAT Working Group <whatwg@whatwg.org>
Hi folks,

Boris Zbarsky and I ran across a "not reflecting reality" issue in the

The spec currently defines the rendering of the <br> element as follows:
 # br { content: '\A'; white-space: pre; }

This CSS implies that <br>'s rendering could be customized by CSS, which
in practice (in the browsers that I tested[1]) is not actually the case.

In particular: given the spec's CSS quoted above, you might expect that
perhaps an author could set...
   "white-space: nowrap"
... on a <br> element, to neuter the linebreak. That doesn't work,
though -- the <br> still triggers a linebreak. Similarly, you might also
expect to be able to customize the 'display' or 'height'/'width' or
'background' properties, but in practice, none of those have any effect
on <br> in modern browsers.

So: to reflect reality, it might be better to specify <br> in a way that
doesn't suggest it's as customizable with CSS. (for the "white-space"
property in particular, but probably others as well)

For reference, here's a page with a few testcases:
The browsers that I tested[1] all agree on the rendering (basically, not
honoring any of the <br> styling), with one minor exception[2].


[1] I tested the following browsers:
 Firefox 26
 Opera 12.16
 Chrome 34.0.1788.0 dev
 IE 11

[2] I only noticed one rendering difference -- IE11 honors "border" on
<br>, unlike the other browsers that I tested. (It still doesn't honor
e.g. "display"/"width"/"height", though.)
Received on Wednesday, 22 January 2014 21:52:04 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:15 UTC