W3C home > Mailing lists > Public > public-css-archive@w3.org > March 2020

[csswg-drafts] [css2?] Rendering of the <br> element when margins are applied (#4856)

From: Emilio Cobos Álvarez via GitHub <sysbot+gh@w3.org>
Date: Tue, 10 Mar 2020 20:55:56 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-578855997-1583873754-sysbot+gh@w3.org>
emilio has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css2?] Rendering of the <br> element when margins are applied ==
TLDR: Somebody reported an interesting issue in their site, which happened to do with differences across browsers in how `<br>` applies (or doesn't) margin: https://bugzilla.mozilla.org/show_bug.cgi?id=1621387

I don't think the rendering of `<br>` is very well specified other than "it introduces a forced line-break" and such... should it honor margin?

Gecko does in: `data:text/html,<p>Foo<br style="margin: 200px"></p>`

It seems to be long-standing behavior, and something that caught my eye is that MDN says this is something that you can do:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/br:

> You can set a margin on `<br>` elements themselves to increase the spacing between the lines of text in the block, but this is a bad practice — you should use the line-height property that was designed for that purpose.

Which is odd because not even IE11 seems to do this. Assuming I'm not missing anything, we should probably change Firefox and specify the behavior of other browsers somewhere (where should rendering of the `<br>` element live? html? Ideally it should be less magical...).

Is there any case where `<br>` respects margins in other browsers?

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4856 using your GitHub account
Received on Tuesday, 10 March 2020 20:55:59 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:02 UTC