Skip to content

[css-lists] Interaction of ::marker with other pseudo-elements. #3826

@emilio

Description

@emilio

A few different questions that occurred to me, that should probably be tested and clarified on the spec, and they interact with each other.

Do ::before and ::after generate markers?

In #3766 it was clarified that they increment the list-item counter and are considered list items. But do they generate marker boxes?

Browsers generally do (Edge didn't use to though, so we may have some leeway). It's a bit weird that we're generating nested pseudo-elements.

If they do... Do those markers generated by pseudo-elements match selectors from the page?

WebKit and Gecko's implementation do show two red bullets here:

<!doctype html>
<style>
  li::after {
    content: "After";
    display: list-item;
  }
  ::marker {
    color: red;
  }
</style>
<ul>
  <li>Bar

But then that means that you can address a marker generated by a pseudo-element with selectors. Which is inconsistent in the sense that it doesn't happen for ::before and ::after. Which carries me to the next question...

If they do... Does display apply to ::marker? And thus, can ::marker boxes be list items?

If we allow content on marker, they can just be a normal box, affected by display, and thus have display: list-item on them. If generated markers can be list items, then:

  • Do they increment the list-item counter?
  • Do they generate other markers?

I really hope the answer to these two question is "no", but otherwise, how should this work?

<!doctype html>
<style>
  li::after {
    content: "After";
    display: list-item;
  }
  ::marker {
    display: list-item;
    content: counter(list-item) ".";
  }
</style>
<ol>
  <li>Foo
  <li>Bar

I think ::marker shouldn't be a list-item, even if it's a box with display: list-item like @fantasai clarified in #3766, and that it should not increment the list-item counter nor generate other markers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Closed as Question AnsweredUsed when the issue is more of a question than a problem, and it's been answered.Commenter SatisfiedCommenter has indicated satisfaction with the resolution / edits.css-lists-3Current Workcss-lists-4

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions