CSS ::marker pseudo-element
- Previous Page ::highlight()
- Next Page ::placeholder
- Go to the Previous Level CSS Pseudo-element Reference Manual
Definition and usage
CSS ::marker
The pseudo-element is used to set the style of the list item marker.
This pseudo-element is applicable to any element set to display: list-item.
Note:The following properties can be used with ::marker
Used together:
- All font properties
- All animation properties
- All transition properties
- color
- white-space
- content
- text-combine-upright
- unicode-bidi
- direction
Example
Example 1
Set the color and font size for all list item markers:
::marker { font-size: 20px; color: red;
Example 2
Set the content, color, and font size for the list item marker of the <ul> list:
ul li::marker { content: "@ "; color: pink; font-size: 25px;
Example 3
Set the <h2> element to display: list-item and set the content and color for the list item marker:
h2 { counter-increment: h2; display: list-item; h2::marker { display: list-item; content: "@" counter(h2) " "; color: lightgreen; body { counter-reset: h2; font-family: verdana; margin: 50px;
CSS Syntax
::marker { css declarations
Technical details
Version: | CSS3 |
---|
Browser support
The numbers in the table specify the first browser version that fully supports this pseudo-element.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
86 | 86 | 68 | 18.1 | 72 |
Related pages
Tutorial:CSS Pseudo-element
- Previous Page ::highlight()
- Next Page ::placeholder
- Go to the Previous Level CSS Pseudo-element Reference Manual