- From: 張俊芝 via GitHub <sysbot+gh@w3.org>
- Date: Fri, 17 Aug 2018 10:28:04 +0000
- To: public-css-archive@w3.org
Zhang-Junzhi has just created a new issue for https://github.com/w3c/csswg-drafts: == interoperability regarding to styling <br> and <wbr> == I know this issue looks bizarre at first glance. Why is one ever in demand of styling `<br>` and `<wbr>`? I never thought of this question either, until I decided to reset all UA styles and rewrite my own default stylesheet in a use case, in order to gain "completely" controllable styling without being interfered by any default styles(except those of the user's): ``` * { all: unset; } ``` And then, inadvertently, I found that `<br>` and `<wbr>` weren't rendered in the way in what I initially expected them to be rendered: In both Firefox and Chrome, the newlines still presisted. In theory, because their `display` values became the initial value `inline`, and their `white-space` values became the initial value `normal`, even they created extra or possible extra new lines to the document content, those created newlines shouldn't have presisted as "still newlines" under this circumstance. At the very least, I would expected they should have been "converted" to a normal white space if their surrounding characters weren't also white spaces. This got me interested, then I continued to try to find out other special behaviours of `<br>` and `<wbr>` in various circumstances, and then I found in both of the two browsers I tested in, `<br>` and `<wbr>` have very special behaviour, they ignore almost all the CSS properties, for example: ``` br { display: flow-root; height: 100px; width: 100px; background: red; } ``` doesn't take any effect at all. As far as I can tell, only `display: none` and `display: contents` takes effects on `<br>`, `<wbr>`. Since I only tested Firefox and Chrome, I am not sure if the interoperability of `all: unset;` among all browsers is guaranteed for `<br>`, `<wbr>` is safe. The spec seems silent about this issue, leaving it unexplained, and the unexaplained special behaviour on `<br>` and `<wbr>` seems to be anti-consistent mental model. Back to the use case, the safest method that may keep interoperability I can think of right now is unsetting properties by excluding `<br>`, `<wbr>` ``` :not(br):not(wbr) { all: unset; } ``` Any ideas on this issue? I am looking forward to hearing from you. Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3026 using your GitHub account
Received on Friday, 17 August 2018 10:28:06 UTC