8000 [css2?] Rendering of the <br> element when margins are applied · Issue #4856 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

[css2?] Rendering of the <br> element when margins are applied #4856

@emilio

Description

@emilio

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0