# Custom properties (--*): CSS variables Baseline Widely available This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2017. * Learn more * See full compatibility * Report feedback Property names that are prefixed with `--`, like `--example-name`, represent _custom properties_ that contain a value that can be used in other declarations using the `var()` function. Custom properties are scoped to the element(s) they are declared on, and participate in the cascade: the value of such a custom property is that from the declaration decided by the cascading algorithm. Initial value | see prose ---|--- Applies to | all elements Inherited | yes Computed value | as specified with variables substituted Animation type | discrete ## Syntax --some-keyword: left; --some-color: #0000ff; --some-complex-value: 3px 6px rgb(20 32 54); `` This value matches any sequence of one or more tokens, so long as the sequence does not contain any disallowed token. It represents the entirety of what a valid declaration can have as its value. **Note:** Custom property names are case sensitive — `--my-color` will be treated as a separate custom property to `--My-color`. ## Example ### HTML

This paragraph should have a blue background and yellow text.

This paragraph should have a yellow background and blue text.

This paragraph should have a green background and yellow text.

### CSS :root { --first-color: #16f; --second-color: #ff7; } #firstParagraph { background-color: var(--first-color); color: var(--second-color); } #secondParagraph { background-color: var(--second-color); color: var(--first-color); } #container { --first-color: #290; } #thirdParagraph { background-color: var(--first-color); color: var(--second-color); } ### Result ## Specifications ## Browser compatibility | Desktop | Mobile ---|---|--- | Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android `--*` | 49 | 15 | 31 | 36 | 9.1 | 49 | 31 | 36 | 9.3 | 5.0 | 49 ## See also * The `var()` function * `@property` at-rule * Using CSS custom properties (variables) guide * CSS custom properties for cascading variables module # -webkit-border-before **Non-standard:** This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists. The `-webkit-border-before` CSS property is a shorthand property for setting the individual logical block start border property values in a single place in the style sheet. ## Constituent properties This property is a shorthand for the following CSS properties: * `-webkit-border-before-color` * `-webkit-border-before-style` * `-webkit-border-before-width` ## Syntax /* Border values */ -webkit-border-before: 1px; -webkit-border-before: 2px dotted; -webkit-border-before: medium dashed blue; /* Global values */ -webkit-border-before: inherit; -webkit-border-before: initial; -webkit-border-before: revert; -webkit-border-before: revert-layer; -webkit-border-before: unset; ### Values One or more of the following, in any order: `<'border-width'>` See `border-width` `<'border-style'>` See `border-style` `<'color'>` See `color` ## Description The `-webkit-border-before` property maps to a physical border depending on the element's writing mode, directionality, and text orientation. It corresponds to the `border-top`, `border-right`, `border-bottom`, or `border- left` property depending on the values defined for `writing-mode`, `direction`, and `text-orientation`. It relates to `-webkit-border-after`, `-webkit-border-start`, and `-webkit- border-end`, which define the other borders of the element. The standard-track equivalent of this property is `border-block-start`. ## Formal definition Initial value | as each of the properties of the shorthand: * `border-width`: as each of the properties of the shorthand: * `border-top-width`: `medium` * `border-right-width`: `medium` * `border-bottom-width`: `medium` * `border-left-width`: `medium` * `border-style`: as each of the properties of the shorthand: * `border-top-style`: `none` * `border-right-style`: `none` * `border-bottom-style`: `none` * `border-left-style`: `none` * `color`: `canvastext` ---|--- Applies to | all elements Inherited | yes Percentages | as each of the properties of the shorthand: * `-webkit-border-before-width`: logical-width of containing block Computed value | as each of the properties of the shorthand: * `border-width`: as each of the properties of the shorthand: * `border-bottom-width`: the absolute length or `0` if `border-bottom-style` is `none` or `hidden` * `border-left-width`: the absolute length or `0` if `border-left-style` is `none` or `hidden` * `border-right-width`: the absolute length or `0` if `border-right-style` is `none` or `hidden` * `border-top-width`: the absolute length or `0` if `border-top-style` is `none` or `hidden` * `border-style`: as each of the properties of the shorthand: * `border-bottom-style`: as specified * `border-left-style`: as specified * `border-right-style`: as specified * `border-top-style`: as specified * `color`: computed color Animation type | discrete ## Formal syntax -webkit-border-before = <'border-width'> || <'border-style'> || = {1,4} = {1,4} = | thin | medium | thick = none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset Sources: CSS Backgrounds and Borders Module Level 3 ## Examples ### Applying a border with vertical text #### HTML

Example text

#### CSS div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-rl; -webkit-border-before: 5px dashed blue; } #### Result ## Specifications Not part of any standard, but it relates to the standards-track `border-block- start` property. ## Browser compatibility | Desktop | Mobile ---|---|--- | Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android `-webkit-border-before` | 8 | 79 | No | 15 | 5.1 | 18 | No | 15 | 5 | 1.0 | 3 ## See also * `border-block-start` * The mapped physical properties: `border-top`, `border-right`, `border-bottom`, and `border-left` * `writing-mode`, `direction`, `text-orientation` # -webkit-tap-highlight-color **Non-standard:** This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists. `-webkit-tap-highlight-color` is a non-standard CSS property that sets the color of the highlight that appears over a link while it's being tapped. The highlighting indicates to the user that their tap is being successfully recognized, and indicates which element they're tapping on. ## Syntax -webkit-tap-highlight-color: red; -webkit-tap-highlight-color: transparent; /* for removing the highlight */ /* Global values */ -webkit-tap-highlight-color: inherit; -webkit-tap-highlight-color: initial; -webkit-tap-highlight-color: revert; -webkit-tap-highlight-color: revert-layer; -webkit-tap-highlight-color: unset; ### Values A ``. ## Formal definition Initial value | `black` ---|--- Applies to | all elements Inherited | yes Computed value | as specified Animation type | discrete ## Formal syntax -webkit-tap-highlight-color = ## Specifications Not part of any standard. Apple has a description in the Safari Web Content Guide. ## Browser compatibility | Desktop | Mobile ---|---|--- | Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android `-webkit-tap-highlight-color` | 16 | 12 | No | 15 | No | 18 | No | 14 | 4 | 1.0 | 4.4 ## See also * WebKit CSS extensions * Related CSS pseudo-classes: * `:hover` * `:active` * `:visited` # -webkit-text-fill-color Baseline Widely available This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2016. * Learn more * See full compatibility * Report feedback The `-webkit-text-fill-color` CSS property specifies the fill color of characters of text. If this property is not set, the value of the `color` property is used. ## Syntax /* values */ -webkit-text-fill-color: red; -webkit-text-fill-color: #000000; -webkit-text-fill-color: rgb(100 200 0); /* Global values */ -webkit-text-fill-color: inherit; -webkit-text-fill-color: initial; -webkit-text-fill-color: revert; -webkit-text-fill-color: revert-layer; -webkit-text-fill-color: unset; ### Values `` The foreground fill color of the element's text content. ## Formal definition Initial value | `currentcolor` ---|--- Applies to | all elements Inherited | yes Computed value | computed color Animation type | a color ## Formal syntax -webkit-text-fill-color = Sources: Compatibility Standard ## Examples ### Changing the fill color #### CSS p { margin: 0; font-size: 3em; -webkit-text-fill-color: green; } #### HTML

This text is green.

#### Results ## Specifications ## Browser compatibility | Desktop | Mobile ---|---|--- | Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android `-webkit-text-fill-color` | 1 | 12 | 49 | 15 | 3 | 18 | 49 | 15 | 2 | 1.0 | 37 ## See also * Introducing Text-Stroke on webkit.org (2006) * CSS-Tricks article explaining this feature * `-webkit-text-stroke-color` * `-webkit-text-stroke-width` * `-webkit-text-stroke` # -webkit-text-stroke-color Baseline Widely available This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2017. * Learn more * See full compatibility * Report feedback The `-webkit-text-stroke-color` CSS property specifies the stroke color of characters of text. If this property is not set, the value of the `color` property is used. ## Syntax /* values */ -webkit-text-stroke-color: red; -webkit-text-stroke-color: #e08ab4; -webkit-text-stroke-color: rgb(200 100 0); /* Global values */ -webkit-text-stroke-color: inherit; -webkit-text-stroke-color: initial; -webkit-text-stroke-color: revert; -webkit-text-stroke-color: revert-layer; -webkit-text-stroke-color: unset; ### Values `` The color of the stroke. ## Formal definition Initial value | `currentcolor` ---|--- Applies to | all elements Inherited | yes Computed value | computed color Animation type | a color ## Formal syntax -webkit-text-stroke-color = Sources: Compatibility Standard ## Examples ### Varying the stroke color #### HTML

Text with stroke

#### CSS p { margin: 0; font-size: 4em; -webkit-text-stroke-width: 3px; -webkit-text-stroke-color: #ff0000; /* Can be changed in the live sample */ } #### Results ## Specifications ## Browser compatibility | Desktop | Mobile ---|---|--- | Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android `-webkit-text-stroke-color` | 1 | 15 | 49 | 15 | 3 | 18 | 49 | 15 | 2 | 1.0 | 37 ## See also * Introducing Text-Stroke on webkit.org (2006) * CSS-Tricks article explaining this feature * `-webkit-text-fill-color` * `-webkit-text-stroke-width` * `-webkit-text-stroke` # -webkit-text-stroke-width Baseline Widely available This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2017. * Learn more * See full compatibility * Report feedback The `-webkit-text-stroke-width` CSS property specifies the width of the stroke for text. ## Syntax /* Keyword values */ -webkit-text-stroke-width: thin; -webkit-text-stroke-width: medium; -webkit-text-stroke-width: thick; /* values */ -webkit-text-stroke-width: 2px; -webkit-text-stroke-width: 0.1em; -webkit-text-stroke-width: 1mm; -webkit-text-stroke-width: 5pt; /* Global values */ -webkit-text-stroke-width: inherit; -webkit-text-stroke-width: initial; -webkit-text-stroke-width: revert; -webkit-text-stroke-width: revert-layer; -webkit-text-stroke-width: unset; ### Values `` The width of the stroke. ## Formal definition Initial value | `0` ---|--- Applies to | all elements Inherited | yes Computed value | absolute `` Animation type | discrete ## Formal syntax -webkit-text-stroke-width = = | thin | medium | thick Sources: Compatibility Standard, CSS Backgrounds and Borders Module Level 3 ## Examples ### Varying stroke widths #### CSS p { margin: 0; font-size: 4em; -webkit-text-stroke-color: red; } #thin { -webkit-text-stroke-width: thin; } #medium { -webkit-text-stroke-width: 3px; } #thick { -webkit-text-stroke-width: 1.5mm; } #### HTML

Thin stroke

Medium stroke

Thick stroke

#### Results ## Specifications ## Browser compatibility | Desktop | Mobile ---|---|--- | Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android `-webkit-text-stroke-width` | 1 | 15 | 49 | 15 | 3 | 18 | 49 | 15 | 2 | 1.0 | 38 ## See also * Introducing Text-Stroke on webkit.org (2006) * CSS-Tricks article explaining this feature * `-webkit-text-stroke-color` * `-webkit-text-stroke` * `-webkit-text-fill-color` # -webkit-text-stroke Baseline Widely available This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2017. * Learn more * See full compatibility * Report feedback The `-webkit-text-stroke` CSS property specifies the width and color of strokes for text characters. This is a shorthand property for the longhand properties `-webkit-text-stroke-width` and `-webkit-text-stroke-color`. /* Width and color values */ -webkit-text-stroke: 4px navy; /* Global values */ -webkit-text-stroke: inherit; -webkit-text-stroke: initial; -webkit-text-stroke: revert; -webkit-text-stroke: revert-layer; -webkit-text-stroke: unset; ## Constituent properties This property is a shorthand for the following CSS properties: * `-webkit-text-stroke-color` * `-webkit-text-stroke-width` ## Syntax ### Values `` The width of the stroke. `` The color of the stroke. ## Formal definition Initial value | as each of the properties of the shorthand: * `-webkit-text-stroke-width`: `0` * `-webkit-text-stroke-color`: `currentcolor` ---|--- Applies to | all elements Inherited | yes Computed value | as each of the properties of the shorthand: * `-webkit-text-stroke-width`: absolute `` * `-webkit-text-stroke-color`: computed color Animation type | as each of the properties of the shorthand: * `-webkit-text-stroke-width`: discrete * `-webkit-text-stroke-color`: a color ## Formal syntax -webkit-text-stroke = || = | thin | medium | thick Sources: Compatibility Standard, CSS Backgrounds and Borders Module Level 3 ## Examples ### Adding a red text stroke #### HTML

The stroke of this text is red.

#### CSS #example { font-size: 3em; margin: 0; -webkit-text-stroke: 2px red; } #### Result ## Specifications ## Browser compatibility | Desktop | Mobile ---|---|--- | Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android `-webkit-text-stroke` | 4 | 15 | 49 | 15 | 3 | 18 | 49 | 14 | 2 | 1.0 | 4 ## See also * Introducing Text-Stroke on webkit.org (2006) * CSS-Tricks article explaining this feature * `-webkit-text-stroke-width` * `-webkit-text-stroke-color` * `-webkit-text-fill-color` # :-moz-first-node **Non-standard:** This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists. **Experimental:** **This is an experimental technology** Check the Browser compatibility table carefully before using this in production. The `:-moz-first-node` CSS pseudo-class is a Mozilla extension that represents any element that is the first child node of some other element. It differs from `:first-child` because it does not match a first-child element with (non- whitespace) text before it. **Note:** Any whitespace at the start of an element is ignored for the determination of `:-moz-first-node`. ## Syntax :-moz-first-node { /* ... */ } ## Examples ### CSS span:-moz-first-node { background-color: lime; } ### HTML

This matches! This doesn't match.

Blahblah. This doesn't match because it's preceded by text.

### Result ## Specifications Not part of any standard. ## Browser compatibility | Desktop | Mobile ---|---|--- | Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android `:-moz-first-node` | No | No | ≤72 | No | No | No | ≤79 | No | No | No | No ## See also * `:-moz-last-node` * `:first-child` # :-moz-last-node **Non-standard:** This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists. **Experimental:** **This is an experimental technology** Check the Browser compatibility table carefully before using this in production. The `:-moz-last-node` CSS pseudo-class is a Mozilla extension that represents any element that is the last child node of some other element. It differs from `:last-child` because it does not match a last-child element with (non- whitespace) text after it. **Note:** Any whitespace at the end of an element is ignored for the determination of `:-moz-last-node`. ## Syntax :-moz-last-node { /* ... */ } ## Examples ### CSS span:-moz-last-node { background-color: lime; } ### HTML

This does not match. This matches!

This doesn't match because it's followed by text. Blahblah.

### Result ## Specifications Not part of any standard. ## Browser compatibility | Desktop | Mobile ---|---|--- | Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android `:-moz-last-node` | No | No | ≤72 | No | No | No | ≤79 | No | No | No | No ## See also * `:-moz-first-node` * `:last-child` # :-moz-only-whitespace **Non-standard:** This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists. **Note:** In Selectors Level 4, the `:empty` selector was changed to act like `:-moz-only-whitespace`, but no browser currently supports this yet. The `:-moz-only-whitespace` CSS pseudo-class matches elements that only contain text nodes that only contain whitespace. (This includes elements with empty text nodes and elements with no child nodes.) ## Syntax :-moz-only-whitespace { /* ... */ } ## Examples ### Basic :-moz-only-whitespace example #### HTML
#### CSS div { border: 4px solid red; } :-moz-only-whitespace { border-color: lime; } #### Result ## Specifications Briefly defined as `:blank` in Selectors Level 4, but then the functionality was merged into `:empty` and `:blank` redefined to mean empty ``. ## Browser compatibility | Desktop | Mobile ---|---|--- | Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android `:-moz-only-whitespace` | No | No | 1 | No | No | No | 4 | No | No | No | No ## See also * `:blank` * `:empty` # :-moz-submit-invalid **Non-standard:** This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists. The `:-moz-submit-invalid` CSS pseudo-class is a Mozilla extension that represents any submit `

The background shown outside of this dialog is a backdrop.

const showDialogBtn = document.getElementById("showDialogBtn"); const favDialog = document.getElementById("favDialog"); showDialogBtn.addEventListener("click", () => favDialog.showModal()); ## Syntax ::backdrop { /* ... */ } ## Description Backdrops appear in the following instances: * Elements which have been placed in fullscreen mode using the Fullscreen API `Element.requestFullscreen()` method. * `` elements that have been shown in the top layer via a `HTMLDialogElement.showModal()` call. * Popover elements that have been shown in the top layer via a `HTMLElement.showPopover()` call. When multiple elements have been placed into the top layer, each one has its own `::backdrop` pseudo-element. /* Backdrop is only displayed when dialog is opened with dialog.showModal() */ dialog::backdrop { background: rgb(255 0 0 / 25%); } Elements are placed in a last-in/first out (LIFO) stack in the top layer. The `::backdrop` pseudo-element makes it possible to obscure, style, or completely hide everything located below a top layer element. `::backdrop` neither inherits from nor is inherited by any other elements. No restrictions are made on what properties apply to this pseudo-element. ## Examples ### Styling a modal dialog's backdrop In this example, we use the `::backdrop` pseudo-element to style the backdrop that is used when a modal `` is open. #### HTML We include a `

This modal dialog has a beautiful backdrop!

#### CSS We add a background to the backdrop, creating a colorful donut using CSS gradients: ::backdrop { background-image: radial-gradient( circle, #fff 0 5vw, transparent 5vw 20vw, #fff 20vw 22.5vw, #eee 22.5vw ), conic-gradient( #272b66 0 50grad, #2d559f 50grad 100grad, #9ac147 100grad 150grad, #639b47 150grad 200grad, #e1e23b 200grad 250grad, #f7941e 250grad 300grad, #662a6c 300grad 350grad, #9a1d34 350grad 400grad, #43a1cd 100grad 150grad, #ba3e2e ); } #### JavaScript The dialog is opened modally using the `.showModal()` method and closed using the `.close()` method. const dialog = document.querySelector("dialog"); const showButton = document.querySelector("dialog + button"); const closeButton = document.querySelector("dialog button"); // "Show the dialog" button opens the dialog modally showButton.addEventListener("click", () => { dialog.showModal(); }); // "Close" button closes the dialog closeButton.addEventListener("click", () => { dialog.close(); }); #### Results ## Specifications ## Browser compatibility | Desktop | Mobile ---|---|--- | Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android `::backdrop` | 3732 | 7912–79 | 47 | 2419 | 15.4 | 3732 | 47 | 2419 | 15.4 | 3.02.0 | 374.4.3 `dialog` | 32 | 79 | 98 | 19 | 15.4 | 32 | 98 | 19 | 15.4 | 2.0 | 4.4.3 `fullscreen` | 69 | 12 | 47 | 56 | 16.4 | 69 | 47 | 48 | 16.4 | 10.0 | 69 `inherit_from_originating_element` | 122 | 122 | 120 | 108 | 17.4 | 122 | 120 | 81 | 17.4 | 26.0 | 122 `popover` | 114 | 114 | 125 | 100 | 17 | 114 | 125 | 76 | 17 | 23.0 | 114 ## See also * `:fullscreen` pseudo-class * `` HTML element * Fullscreen API * `popover` HTML global attribute * Popover API # ::before Baseline Widely available This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015. * Learn more * See full compatibility * Report feedback In CSS, `::before` creates a pseudo-element that is the first child of the selected element. It is often used to add cosmetic content to an element with the `content` property. It is inline by default. ## Try it a { color: #0000ff; text-decoration: none; } a::before { content: "🔗"; } .local-link::before { content: url("/shared-assets/images/examples/firefox-logo.svg"); display: inline-block; width: 15px; height: 15px; margin-right: 5px; }

Learning resources for web developers can be found all over the internet. Try out web.dev, w3schools.com or our MDN web docs.

## Syntax ::before { content: /* value */; /* properties */ } ## Description The `::before` pseudo-element is an inline box generated as an immediate child of the element it is associated with, or the "originating element". It is often used to add cosmetic content to an element via the `content` property, such as icons, quote marks, or other decoration. `::before` pseudo-elements can't be applied to _replaced elements_ such as ``, whose contents are determined by external resources and not affected by the current document's styles. A `::before` pseudo-element with a `display` value of `list-item` behaves like a list item, and can therefore generate a `::marker` pseudo-element just like an `
  • ` element. If the `content` property is not specified, has an invalid value, or has `normal` or `none` as a value, then the `::before` pseudo-element is not rendered. It behaves as if `display: none` is set. **Note:** The Selectors Level 3 specification introduced the double-colon notation `::before` to distinguish pseudo-classes from pseudo-elements. Browsers also accept single-colon notation `:before`, introduced in CSS2. ## Accessibility Using a `::before` pseudo-element to add content is discouraged, as it is not reliably accessible to screen readers. ## Examples ### Quotation marks One example of using `::before` pseudo-elements is to provide quotation marks. Here we use both `::before` and `::after` to insert quotation characters. #### HTML Some quotes, he said, are better than none. #### CSS q::before { content: "«"; color: blue; } q::after { content: "»"; color: red; } #### Result ### Decorative example We can style text or images in the `content` property almost any way we want. #### HTML Notice where the orange box is. #### CSS .ribbon { background-color: #5bc8f7; } .ribbon::before { content: "Look at this orange box."; background-color: #ffba10; border-color: black; border-style: dotted; } #### Result ### To-do list In this example we will create a to-do list using pseudo-elements. This method can often be used to add small touches to the UI and improve user experience. #### HTML
    • Buy milk
    • Take the dog for a walk
    • Exercise
    • Write code
    • Play music
    • Relax
    #### CSS li { list-style-type: none; position: relative; margin: 2px; padding: 0.5em 0.5em 0.5em 2em; background: lightgrey; font-family: sans-serif; } li.done { background: #ccff99; } li.done::before { content: ""; position: absolute; border-color: #009933; border-style: solid; border-width: 0 0.3em 0.25em 0; height: 1em; top: 1.3em; left: 0.6em; margin-top: -1em; transform: rotate(45deg); width: 0.5em; } #### JavaScript const list = document.querySelector("ul"); list.addEventListener( "click", (ev) => { if (ev.target.tagName === "LI") { ev.target.classList.toggle("done"); } }, false, ); Here is the above code example running live. Note that there are no icons used, and the check-mark is actually the `::before` that has been styled in CSS. Go ahead and get some stuff done. #### Result ### Unicode escape sequences As generated content is CSS, not HTML, you **can't** use markup entities in content values. If you need to use a special character, and can't enter it literally into your CSS content string, use a unicode escape sequence. This consists of a backslash followed by the character's hexadecimal unicode value. #### HTML
    1. Crack Eggs into bowl
    2. Add Milk
    3. Add Flour
    4. Mix thoroughly into a smooth batter
    5. Pour a ladleful of batter onto a hot, greased, flat frying pan
    6. Fry until the top of the pancake loses its gloss
    7. Flip it over and fry for a couple more minutes
    8. serve with your favorite topping
    #### CSS li { padding: 0.5em; } li[aria-current="step"] { font-weight: bold; } li[aria-current="step"]::before { content: "\21E8 "; /* Unicode escape sequence for "Rightwards White Arrow" */ display: inline; } #### Result ### `::before::marker` nested pseudo-elements The `::before::marker` nested pseudo-element selects the list `::marker` of an `::after` pseudo-element that is itself a list item, that is, it has its `display` property set to `list-item`. In this demo, we generate extra list items before and after a list navigation menu using `::before` and `::after` (setting them to `display: list-item` so they behave like list items). We then use `ul::before::marker` and `ul::after::marker` to give their list markers a different color. #### HTML #### CSS ul { font-size: 1.5rem; font-family: Arial, Helvetica, sans-serif; } ul::before, ul::after { display: list-item; color: orange; } ul::before { content: "Start"; } ul::after { content: "End"; } ul::before::marker, ul::after::marker { color: red; } #### Result While the list bullets of the three navigation items are generated because they are `
  • ` elements, "Start" and "End" have been inserted via pseudo- elements and `::marker` is used to style their bullets. ## Specifications ## Browser compatibility | Desktop | Mobile ---|---|--- | Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android `::before` | 11 | 1212 | 1.5["Before Firefox 57, Firefox had a bug where `::before` pseudo-elements were still generated, even if the `content` property value were set to `normal` or `none`.", "Before Firefox 3.5, only the CSS level 2 behavior of `:before` was supported, which disallowed `position`, `float`, `list-style-*` and some `display` properties."]1 | 74 | 44 | 1818 | 4Before Firefox 57, Firefox had a bug where `::before` pseudo-elements were still generated, even if the `content` property value were set to `normal` or `none`.4 | 10.110.1 | 33 | 1.01.0 | 4.44.4 `animation_and_transition_support` | 26 | 12 | 4 | 15 | 7 | 26 | 4 | 14 | 7 | 1.5 | 4.4 `nested_marker` | 135 | 135 | No | 120 | No | 135 | No | 89 | No | No | 135 ## See also * `::after` * `content` # ::checkmark Limited availability This feature is not Baseline because it does not work in some of the most widely-used browsers. * Learn more * See full compatibility * Report feedback **Experimental:** **This is an experimental technology** Check the Browser compatibility table carefully before using this in production. The `::checkmark` CSS pseudo-element targets the checkmark placed inside the currently-selected ``, `