SelectorBaseline: widely availablesince January 2018
Spec Represents a styleable child pseudo-element immediately after the originating element’s actual content.
MDN In CSS, ::after creates a pseudo-element that is the last 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.
<p> The sailfish is named for its sail-like dorsal fin and is widely considered the fastest fish in the ocean. <a href="https://en.wikipedia.org/wiki/Sailfish" >You can read more about it here</a >.</p><p> The red lionfish is a predatory scorpionfish that lives on coral reefs of the Indo-Pacific Ocean and more recently in the western Atlantic. <a href="" class="dead-link">You can read more about it here</a>.</p>
Syntax
::after
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting ::after
Chrome
1
Edge
12
Firefox
1.5
Safari
4
Chrome Android
18
Safari iOS
3.2
First version with support, from MDN browser-compat-data.
SelectorBaseline: widely availablesince January 2018
Spec Represents a styleable child pseudo-element immediately before the originating element’s actual content.
MDN 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.
<p> Learning resources for web developers can be found all over the internet. Try out <a href="https://web.dev/">web.dev</a>, <a href="https://www.w3schools.com/">w3schools.com</a> or our <a href="https://developer.mozilla.org/" class="local-link">MDN web docs</a>.</p>
Syntax
::before
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting ::before
Chrome
1
Edge
12
Firefox
1.5
Safari
4
Chrome Android
18
Safari iOS
3
First version with support, from MDN browser-compat-data.
Spec The ::details-content pseudo-element targets the additional information in a details element that can be expanded or collapsed. It is an element-backed pseudo-element.
MDN The ::details-contentCSSpseudo-element represents the expandable/collapsible contents of a <details> element.
<details open> <summary>Example summary</summary> <p>Lorem ipsum dolor sit amet consectetur adipisicing elit.</p> <p> Architecto cupiditate ea optio modi quas sequi, esse libero asperiores debitis eveniet commodi hic ad. </p></details>
Syntax
::details-content
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting ::details-content
Chrome
131
Edge
131
Firefox
143
Safari
18.4
Chrome Android
131
Safari iOS
18.4
First version with support, from MDN browser-compat-data.
SelectorBaseline: widely availablesince January 2018
Spec The ::first-letter pseudo-element represents the first Letter, Number, or Symbol (Unicode category L*, N*, or S*) typographic character unit on the first formatted line of its originating element (the first letter) as well as its associated punctuation. Collectively, this text is the first-letter text. The ::first-letter pseudo-element can be used to create “initial caps” and “drop caps”, which are common typographic effects.
MDN The ::first-letterCSSpseudo-element applies styles to the first letter of the first line of a block container, but only when not preceded by other content (such as images or inline tables).
<p> Scientists exploring the depths of Monterey Bay unexpectedly encountered a rare and unique species of dragonfish. This species is the rarest of its species.</p><p> When Robison and a team of researchers discovered this fish, they were aboard a week-long expedition.</p>
Syntax
::first-letter
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting ::first-letter
Chrome
1
Edge
12
Firefox
1
Safari
1
Chrome Android
18
Safari iOS
1
First version with support, from MDN browser-compat-data.
<p> In warm ocean waters around the world, you may see a strange sight: A fish leaping from the water and soaring dozens of meters before returning to the ocean's depths. Early Mediterranean sailors thought these flying fish returned to the shore at night to sleep, and therefore called this family of marine fish Exocoetidae.</p>
Syntax
::first-line
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting ::first-line
Chrome
1
Edge
12
Firefox
1
Safari
1
Chrome Android
18
Safari iOS
1
First version with support, from MDN browser-compat-data.
<p id="rainbow-text">CSS Custom Highlight API rainbow</p>
const textNode = document.getElementById("rainbow-text").firstChild;if (!CSS.highlights) { textNode.textContent = "The CSS Custom Highlight API is not supported in this browser!";}// Create and register highlights for each color in the rainbow.const highlights = [];for (let i = 0; i < 7; i++) { // Create a new highlight for this color. const colorHighlight = new Highlight(); highlights.push(colorHighlight); // Register this highlight under a custom name. CSS.highlights.set(`rainbow-color-${i + 1}`, colorHighlight);}// Iterate over the text, character by character.for (let i = 0; i < textNode.textContent.length; i++) { // Create a new range just for this character. const range = new Range(); range.setStart(textNode, i); range.setEnd(textNode, i + 1); // Add the range to the next available highlight, // looping back to the first one once we've reached the 7th. highlights[i % 7].add(range);}
Syntax
::highlight(<highlight-name-selector>)
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting ::highlight()
Chrome
105
Edge
105
Firefox
149
Safari
17.2
Chrome Android
105
Safari iOS
17.2
First version with support, from MDN browser-compat-data.
Spec The ::interest-button pseudo-element represents a button which, when pressed, shows interest in the originating element. This pseudo-element only exists on valid interest sources. (See interest-delay, :interest-source, and :interest-target for more discussion of this feature, and the HTML interestfor attribute.)
Syntax
::interest-button
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting ::interest-button
Chrome
149
Edge
149
Firefox
No
Safari
No
Chrome Android
149
Safari iOS
No
First version with support, from MDN browser-compat-data.
Spec The ::marker pseudo-element represents the automatically generated marker box of a list item. (See [CSS-DISPLAY-3] and [CSS-LISTS-3].)
MDN The ::markerCSSpseudo-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.
Live previewExample from MDN
li::marker { content: "✝ "; font-size: 1.2em;}
<p>Group known as Mercury Seven:</p><ul> <li>Malcolm Scott Carpenter</li> <li>Leroy Gordon (Gordo) Cooper Jr.</li> <li>John Herschel Glenn Jr.</li> <li>Virgil Ivan (Gus) Grissom</li> <li>Walter Marty (Wally) Schirra Jr.</li> <li>Alan Bartlett Shepard Jr.</li> <li>Donald Kent (Deke) Slayton</li></ul>
Syntax
::marker
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting ::marker
Chrome
86
Edge
86
Firefox
68
Safari
11.1
Chrome Android
86
Safari iOS
11.3
First version with support, from MDN browser-compat-data.
Spec The ::search-text pseudo-element represents text identified by the user agent’s find-in-page feature. Since not all UAs style matched text in ways expressible with the highlight pseudo-elements, this pseudo-element is optional to implement. The :current pseudo-class (but not ::current()) may be combined with ::search-text to represent the currently focused match instance. The :past and :future pseudo-classes are reserved for analogous use in the future. Any unsupported combination of these pseudo-classes with ::search-text must be treated as invalid.
MDN The ::search-textCSSpseudo-element applies styles to search results identified by the user agent's "Find" or "Find in page" text search feature.
<p> Using your browser's "Find in page" functionality, find a word or phrase that appears in this sentence, and note how, in supporting browsers, each result is highlighted using the specified custom styles.</p>
Syntax
::search-text
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting ::search-text
Chrome
144
Edge
144
Firefox
No
Safari
No
Chrome Android
144
Safari iOS
No
First version with support, from MDN browser-compat-data.
Spec The ::selection pseudo-element represents the portion of a document that has been selected as the target or object of some possible future user-agent operation(s). It applies, for example, to selected text within an editable text field, which would be copied by a copy operation or replaced by a paste operation.
MDN The ::selectionCSSpseudo-element applies styles to the part of a document that has been highlighted by the user (such as clicking and dragging the mouse across text).
Spec The ::target-text pseudo-element represents text directly targeted by the document URL’s fragment, if any.
MDN The ::target-textCSSpseudo-element represents the text that has been scrolled to if the browser supports text fragments. It allows authors to choose how to highlight that section of text.
Syntax
::target-text
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting ::target-text
Chrome
89
Edge
89
Firefox
131
Safari
18.2
Chrome Android
89
Safari iOS
18.2
First version with support, from MDN browser-compat-data.