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

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 29 Jan 2014 10:57:58 -0800
Message-ID: <CAAWBYDBxpkUYRiaa-z9YVHUTtbkdpYLuT3zoS4nMHRH+P0forA@mail.gmail.com>
To: Daniel Holbert <dholbert@mozilla.com>
Cc: WHAT Working Group <whatwg@whatwg.org>
On Wed, Jan 22, 2014 at 1:51 PM, Daniel Holbert <dholbert@mozilla.com> wrote:
> Hi folks,
>
> Boris Zbarsky and I ran across a "not reflecting reality" issue in the
> WHATWG HTML spec.
>
> The spec currently defines the rendering of the <br> element as follows:
>  # br { content: '\A'; white-space: pre; }
> Source:
> http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#phrasing-content-1
>
> 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.

We talked this over in the CSSWG meeting, and came up with a proposal
for non-magical styling that is still very close to current behavior
in all browsers:

br {
  display-box: contents;
  content: "\A";
  white-space: pre;
}

This lets you adjust the size of the <br> with text-styling
properties, and use display:none to hide it entirely.  Any/all of
these can be set to !important if necessary for compat.

~TJ
Received on Wednesday, 29 January 2014 18:58:45 UTC

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