-
Notifications
You must be signed in to change notification settings - Fork 709
[css-text-3] Line breaking with <br> handled differently. #4658
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
Comments
Oh sorry! Thanks @frivoal. |
But isn't that the point of being magic? If the behavior could be explained with regular CSS, it wouldn't be magic. |
After reading #610 I believe the intention of the magic was performance - the magic means you can't give a BR content, or change it's display, but the functionality itself could be defined in CSS and - as the resolution said - you should be able to "mimic the results". Fantasai gave a definition in CSS of how to do that, but this issue shows that's incomplete. Without being able to mimic it, any non-HTML XML syntax that uses CSS for layout is going to be unable to reproduce the functionality of BR, which doesn't seem right. Edit: another key quote from 610: "...their behavior can be adequately explained by existing CSS rules such as those listed in the above discussion". I don't think that's the case. |
After some more testing, the behaviour of I don't know how much appetite there is for this, but - if fully defining the behaviour of
which would determine if a break opportunity exists before the inline element it's applied on. Setting this to "avoid" on a
|
Have just been pointed towards https://drafts.csswg.org/css-text-4/#wrap-before - which does exactly what I was suggesting. A default rule on "br" of |
I thought by now I had the humble
<br>
element pretty well understood, but apparently not. Please take a look at https://jsbin.com/jupalic/edit?html,css,outputI'm adding a forced line break (a preserved newline character) after an inline that has already overflowed the line - the question is, do I get one line break or two?
It seems that the
<br>
element has some special properties I can't reproduce with any other element, as implemented in Chrome/Firefox/Safari anyway. If I follow the overflowing content with a<span>
, it will begin on a new line (as it should), and I get two line breaks. But if I follow the overflowing content with a<br>
, it is not moved to a new line before being applied, and I get one line break.The behaviour of
<br>
should be entirely determined by CSS according to #610, so I think this is an issue. It might be there is some special HTML rule here that I've missed, although I tested with XHTML and got the same result.Note test B gives different results in Gecko and Blink - the difference appears to be whether the break opportunity before an item of zero width (the left edge of the span) is taken.
EDIT:
For clarification, I'm aware that
<br>
is known to have magical properties - the point of this issue is that those magical properties cannot be duplicated with regular CSS, against the resolution in #610:RESOLVED: keep <br> and <wbr> magic, but add an explainer about how to mimic the results
The text was updated successfully, but these errors were encountered: