W3C home > Mailing lists > Public > public-css-archive@w3.org > April 2017

[csswg-drafts] [css-pseudo] ::first-line when first child is an empty block

From: Loirooriol via GitHub <sysbot+gh@w3.org>
Date: Sat, 01 Apr 2017 19:58:54 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-218719308-1491076732-sysbot+gh@w3.org>
Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-pseudo] ::first-line when first child is an empty block ==
[CSS Pseudo-Elements says](https://drafts.csswg.org/css-pseudo-4/#first-line-pseudo)

> The ::first-line pseudo-element describes the contents of the first formatted line of its originating element.

However, what happens when the first child is an empty block?

Example: https://jsfiddle.net/oyw62a3t/

```html
<div><p></p>Foo</div>
```
```css
div { color: red; }
div::first-line { color: green; }
```

I think the `p` element contains no line, so the first line is Foo. However, Foo is red on Firefox, Chrome and Edge. Is that expected? If so, I think the spec should be clarified. Maybe provide an algorithm like

 - If a block container box has only block-level boxes inside it, its `::first-line` is nested just outside the `::first-line` of the first block-level child.
 - If a block container box has only inline-level boxes inside it, its `::first-line` is nested inside it, containing the inline-level boxes in the first line box, if any.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1158 using your GitHub account
Received on Saturday, 1 April 2017 19:59:00 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:10 UTC