Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do any browsers support the CSS3 pseudo-element "marker"?

Tags:

The spec specifies that one can modify list-item (li) markers using the pseudo-element "marker" like so:

li::marker { color: blue; }

But I can't seem to get it to work in any of my browsers.

Do any browsers support this? Or am I doing something wrong?

like image 460
Avi Flax Avatar asked Dec 31 '10 21:12

Avi Flax


People also ask

Is CSS3 supported by all browsers?

CSS3 Features Supported by All Modern Browsers As a side point in this section, IE9 does provide fairly strong support for CSS3 selectors, pseudo-classes, and pseudo-elements, which you can see here.

What does :: marker do in HTML?

::marker. The ::marker CSS pseudo-element selects the marker box of a list item, which typically contains a bullet or number. It works on any element or pseudo-element set to display: list-item , such as the <li> and <summary> elements.

How do I move a marker in CSS?

The CSS list-style-position property is used to set marker position of list items. The default value for this property is outside which sets the marker outside the list item.


2 Answers

2021 update: all modern browsers have added support for ::marker

  • Firefox since v68
  • Safari since v11.1 (limited to color and font)
  • Chrome (and Edge) since v86
  • Opera since v72

https://developer.mozilla.org/en-US/docs/Web/CSS/::marker#browser_compatibility

like image 107
Rob Avatar answered Sep 17 '22 12:09

Rob


Could you use :before instead?

li {
 display: block;
 list-style-position: inside;
 margin: 0;
}
li:before { 
 content:" • ";  
 color: green;
}
like image 44
Eystein Avatar answered Sep 16 '22 12:09

Eystein