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

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:


> 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