Re: [csswg-drafts] [css-lists] How does the list-item counter affect display? (#4168)

> But, given that there is no UA stylesheet rule that li's render using the list-item counter

It renders because the other CSS properties implies a [generated marker](https://drafts.csswg.org/css-lists-3/#marker-string) that is using the `list-item` counter value. As I outlined in my first reply: if we assume the UA sheet contains `ol { list-style-type: decimal; }` then example 16 needs no additional rules since it's the default rendering for `list-style-type: decimal`. The marker box and its contents is generated by the CSS properties in the sections I indicated. There is no need to have an explicit `::marker` rule. (Btw, there seems to be a typo in this example: I'm assuming the `counter-increment: list-item 2` was intended for the list items, not the `<ol>` as the selector suggests.)

This also implies that a `::marker` rule can be used to style that implicit marker (again, without specifying a `content` property), for example (in Firefox):
```html
<style>::marker{color:red}</style><li>Hi
```
makes the bullet red.

The `::marker` rule in example 17 **is** needed though, because it demonstrates a _non-default_ marker string (it renders the ordinal number of every level in each marker which is **not** the default rendering for `decimal`). (Again, there's a typo: the selector `ol::marker` should be `li::marker`, and there's a missing `</ol>` before the last `<li>`, but with those fixes I get the desired rendering in Firefox.)

> I think the one that applies to UAs is more relevant when we're talking about usefulness to authors (and implementers!), than the example appendix one.

Well, the one in the [css-lists spec](https://drafts.csswg.org/css-lists-3/#ua-stylesheet) is a lot closer to the actual UA sheet we have in Gecko than the ["normative"](https://html.spec.whatwg.org/multipage/rendering.html#rendering)  rules in the [HTML spec](https://html.spec.whatwg.org/multipage/rendering.html#lists) (which lacks `counter-*` properties!).

(I implemented [HTML list numbering using a built-in `list-item` counter](https://bugzilla.mozilla.org/show_bug.cgi?id=288704) and the [`::marker` pseudo](https://bugzilla.mozilla.org/show_bug.cgi?id=205202) in Gecko so I know a little bit about how it's implemented there.)

-- 
GitHub Notification of comment by MatsPalmgren
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4168#issuecomment-517755729 using your GitHub account

Received on Friday, 2 August 2019 16:02:21 UTC