Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
emilio opened this issue Mar 10, 2020 · 3 comments
Open

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

emilio opened this issue Mar 10, 2020 · 3 comments

Comments

@emilio
Copy link
Collaborator

emilio commented Mar 10, 2020

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?

@fantasai
Copy link
Collaborator

Related material: #610

@gsnedders
Copy link
Contributor

Also related: whatwg/html#2291

@frivoal
Copy link
Collaborator

frivoal commented May 26, 2020

As discussed in the links above, the same is true about <wbr>: Firefox lets it have margins, other browsers don't. There's kind of a use case for allowing that, but that use case is better served by https://drafts.csswg.org/css-text-4/#word-boundaries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants