SelectorBaseline: widely availablesince January 2018
Spec The :active pseudo-class applies while an element is being “activated” by the user, as defined by the host language; for example, while a hyperlink is being triggered.
MDN The :activeCSSpseudo-class represents an element (such as a button) that is being activated by the user. When using a mouse, "activation" typically starts when the user presses down the primary mouse button.
Spec The :any-link pseudo-class represents an element that acts as the source anchor of a hyperlink. For example, in [HTML], any a or area elements with an href attribute are hyperlinks, and thus match :any-link. It matches an element if the element would match either :link or :visited, and is equivalent to :is(:link, :visited).
MDN The :any-linkCSSpseudo-class selector represents an element that acts as the source anchor of a hyperlink, independent of whether it has been visited. In other words, it matches every <a> or <area> element that has an href attribute. Thus, it matches all elements that match :link or :visited.
Live previewExample from MDN
p { font-weight: bold;}a:any-link { color: forestgreen; text-decoration-color: hotpink;}
<p>Pages that you might have visited:</p><ul> <li> <a href="https://developer.mozilla.org">MDN Web Docs</a> </li> <li> <a href="https://www.youtube.com/YouTube">Google</a> </li></ul><p>Pages unlikely to be in your history:</p><ul> <li> <a href="https://developer.mozilla.org/missing-3">Random MDN page</a> </li> <li> <a href="https://example.com/missing-3">Random Example page</a> </li></ul>
Syntax
:any-link
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 :any-link
Chrome
65
Edge
79
Firefox
50
Safari
9
Chrome Android
65
Safari iOS
9
First version with support, from MDN browser-compat-data.
Spec The :autofill pseudo-class represents input elements that have been automatically filled by the user agent, and have not been subsequently altered by the user.
MDN The :autofillCSSpseudo-class matches when an <input> element has its value autofilled by the browser. The class stops matching if the user edits the field.
Spec The :buffering pseudo-class represents an element that is capable of being “played” or “paused”, when that element cannot continue playing because it is actively attempting to obtain media data but has not yet obtained enough data to resume playback. (Note that the element is still considered to be “playing” when it is “buffering”. Whenever :buffering matches an element, :playing also matches the element.)
MDN The :bufferingCSSpseudo-class selector represents an element that is playable, such as <audio> or <video>, when the playable element is buffering a media resource.
Syntax
:buffering
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 :buffering
Chrome
158
Edge
158
Firefox
150
Safari
15.4
Chrome Android
158
Safari iOS
15.4
First version with support, from MDN browser-compat-data.
SelectorBaseline: widely availablesince January 2018
Spec When such elements are toggled “on” the :checked pseudo-class applies. For example, [HTML] defines that checked checkboxes, radio buttons, and selected <option> elements match :checked. Similarly, when such elements are toggled “off”, the :unchecked pseudo-class applies.
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec finibus est eget eros congue pellentesque. Etiam a augue accumsan, scelerisque nisl sit amet, lobortis nulla. Aliquam condimentum eu orci eu elementum. Donec porttitor quam et posuere commodo. Mauris rhoncus diam a scelerisque molestie. Integer sollicitudin risus dui, ut sagittis lorem laoreet eget. Duis eget pretium enim. Morbi tristique, diam sit amet gravida finibus, metus ex tincidunt nibh, ac volutpat urna purus et arcu. Donec risus risus, semper vel purus sit amet, gravida vestibulum est. Sed et tristique urna. Nam vel mi eget nisi consectetur elementum. Aenean faucibus aliquam cursus. Morbi posuere tincidunt velit, et sagittis quam sagittis in. Nam eget ante ultrices, auctor dui vel, euismod lacus. Vivamus tincidunt, sem ac sodales aliquet, tortor tortor consequat diam, nec tempor mi dui vel eros. Aliquam ac erat et metus egestas scelerisque.</p>
Syntax
:current
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Spec The :default pseudo-class applies to the one or more UI elements that are the default among a set of similar elements. Typically applies to context menu items, buttons and select lists/menus.
MDN The :defaultCSSpseudo-class selects form elements that are the default in a group of related elements.
Spec In some host languages, elements can have a distinction between being “defined”/“constructed” or not. The :defined pseudo-class matches elements that are fully defined, as dictated by the host language.
MDN The :definedCSSpseudo-class represents any element that has been defined. This includes any standard element built into the browser and custom elements that have been successfully defined (i.e., with the CustomElementRegistry.define() method).
<custom-element> <p> Loaded content: Lorem ipsum tel sed tellus eiusmod tellus. Aenean. Semper dolor sit nisi. Elit porttitor nisi sit vivamus. </p></custom-element><button id="btn">define the <code><custom-element></code></button>
Spec The :dir() pseudo-class allows the author to write selectors that represent an element based on its directionality as determined by the document language. For example, [HTML] defines how to determine the directionality of an element, based on a combination of the dir attribute, the surrounding text, and other factors. As another example, the its:dir and dirRule element of the Internationalization Tag Set [ITS20] are able to define the directionality of an element in [XML10].
MDN The :dir()CSSpseudo-class matches elements based on the directionality of the text contained in them.
Browser support
First browser version supporting :dir()
Chrome
120
Edge
120
Firefox
49
Safari
16.4
Chrome Android
120
Safari iOS
16.4
First version with support, from MDN browser-compat-data.
SelectorBaseline: widely availablesince January 2018
Spec Conversely, the :disabled pseudo-class represents user interface elements that are in a disabled state; such elements must have a corresponding enabled state.
MDN The :disabledCSSpseudo-class represents any disabled element. An element is disabled if it can't be activated (selected, clicked on, typed into, etc.) or accept focus. The element also has an enabled state, in which it can be activated or accept focus.
SelectorBaseline: widely availablesince January 2018
Spec The :empty pseudo-class represents an element that has no children except, optionally, document white space characters. In terms of the document tree, only element nodes and content nodes (such as [DOM] text nodes, and entity references) whose data has a non-zero length must be considered as affecting emptiness; comments, processing instructions, and other nodes must not affect whether an element is considered empty or not.
MDN The :emptyCSSpseudo-class represents any element that has no children. Children can be either element nodes or text (including whitespace). Comments, processing instructions, and CSS content do not affect whether an element is considered empty.
<p>Element with no content:</p><div></div><p>Element with comment:</p><div><!-- A comment --></div><p>Element with nested empty element:</p><div><p></p></div>
Syntax
:empty
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 :empty
Chrome
1
Edge
12
Firefox
1
Safari
3.1
Chrome Android
18
Safari iOS
2
First version with support, from MDN browser-compat-data.
SelectorBaseline: widely availablesince January 2018
Spec The :enabled pseudo-class represents user interface elements that are in an enabled state; such elements must have a corresponding disabled state.
MDN The :enabledCSSpseudo-class represents any enabled element. An element is enabled if it can be activated (selected, clicked on, typed into, etc.) or accept focus. The element also has a disabled state, in which it can't be activated or accept focus.
SelectorBaseline: widely availablesince January 2018
Spec The :focus pseudo-class applies while an element (or pseudo-element) has the focus (accepts keyboard or other forms of input).
MDN The :focusCSSpseudo-class represents an element (such as a form input) that has received focus. It is generally triggered when the user clicks or taps on an element or selects it with the keyboard's <kbd>Tab</kbd> key.
SelectorBaseline: widely availablesince September 2024
Spec While the :focus pseudo-class always matches the currently-focused element, UAs only sometimes visibly indicate focus (such as by drawing a “focus ring”), instead using a variety of heuristics to visibly indicate the focus only when it would be most helpful to the user. The :focus-visible pseudo-class matches a focused element (or pseudo-element) in these situations only, allowing authors to change the appearance of the focus indicator without changing when a focus indicator appears.
MDN The :focus-visible pseudo-class applies while an element matches the :focus pseudo-class and the UA (User Agent) determines via heuristics that the focus should be made evident on the element. (Many browsers show a "focus ring" by default in this case.)
Spec The :focus-within pseudo-class applies to any element (or pseudo-element) for which the :focus pseudo-class applies, as well as to an element (or pseudo-element) whose descendant in the flat tree (including non-element nodes, such as text nodes) matches the conditions for matching :focus.
MDN The :focus-withinCSSpseudo-class matches an element if the element or any of its descendants are focused. In other words, it represents an element that is itself matched by the :focus pseudo-class or has a descendant that is matched by :focus. (This includes descendants in shadow trees.)
Spec The :fullscreen pseudo-class represents an element which is displayed in a mode that takes up most (usually all) of the screen, such as that defined by the Fullscreen API. [FULLSCREEN]
MDN The :fullscreenCSSpseudo-class matches every element that is currently in fullscreen mode. If multiple elements have been put into fullscreen mode, this selects them all.
<div class="element"> <h1><code>:fullscreen</code> pseudo-class demo</h1> <p> This demo uses the <code>:fullscreen</code> pseudo-class to automatically change the background color of the <code>.element</code> div. </p> <p> Normally, the background is light yellow. In fullscreen mode, the background is light pink. </p> <button class="toggle">Toggle Fullscreen</button></div>
document.querySelector(".toggle").addEventListener("click", (event) => { if (document.fullscreenElement) { // If there is a fullscreen element, exit full screen. document.exitFullscreen(); return; } // Make the .element div fullscreen. document.querySelector(".element").requestFullscreen();});
Syntax
:fullscreen
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 :fullscreen
Chrome
71
Edge
12
Firefox
64
Safari
16.4
Chrome Android
71
Safari iOS
16.4
First version with support, from MDN browser-compat-data.
Spec The :future pseudo-class represents any element that is defined to occur entirely after a :current element. For example, the WebVTT spec defines the :future pseudo-class relative to the current playback position of a media element. If a time-based order of elements is not defined by the document language, then this represents any element that is a (possibly indirect) next sibling of a :current element.
MDN The :futureCSSpseudo-class selector is a time-dimensional pseudo-class that will match for any element which appears entirely after an element that matches :current. For example in a video with captions which are being displayed by WebVTT.
Syntax
:future
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 :future
Chrome
23
Edge
79
Firefox
No
Safari
7
Chrome Android
25
Safari iOS
7
First version with support, from MDN browser-compat-data.
Spec The relational pseudo-class, :has(), is a functional pseudo-class taking a <relative-selector-list> as an argument. It represents an element if any of the relative selectors would match at least one element when anchored against this element.
MDN The functional :has()CSSpseudo-class represents an element if any of the relative selectors that are passed as an argument match at least one element when anchored against this element. This pseudo-class presents a way of selecting a parent element or a previous sibling element with respect to a reference element by taking a relative selector list as an argument.
Spec The (non-functional) :heading pseudo-class matches an element which has a heading level, with respect to the semantics defined by the document language (e.g. [HTML5]).
<h1>Mastering CSS</h1><h2>Chapter 1: Selectors</h2><p> A CSS selector is the part of a CSS rule that describes what elements in a document the rule will match.</p><h3>1.1 Pseudo-classes</h3><p> CSS pseudo-classes enable selecting elements based on information that lies outside of the document tree.</p>
Syntax
:heading
:heading( <level># )
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 :heading
Chrome
No
Edge
No
Firefox
Preview (flag)
Safari
27
Chrome Android
No
Safari iOS
27
First version with support, from MDN browser-compat-data.
SelectorBaseline: widely availablesince January 2018
Spec The :hover pseudo-class applies while the user designates an element (or pseudo-element) with a pointing device, but does not necessarily activate it. For example, a visual user agent could apply this pseudo-class when the cursor (mouse pointer) hovers over a box generated by the element. Interactive user agents that cannot detect hovering due to hardware limitations (e.g., a pen device that does not detect hovering) are still conforming; the selector will simply never match in such a UA.
MDN The :hoverCSSpseudo-class matches an element when a user interacts with it using a pointing device. The pseudo-class is generally triggered when the user moves the cursor (mouse pointer) over an element without pressing the mouse button.
SelectorBaseline: widely availablesince January 2018
Spec The :in-range and :out-of-range pseudo-classes apply only to elements that have range limitations. An element is :in-range or :out-of-range when the value that the element is bound to is in range or out of range with respect to its range limits as defined by the document language. An element that lacks data range limits or is not a form control is neither :in-range nor :out-of-range. E.g. a slider element with a value of 11 presented as a slider control that only represents the values from 1-10 is :out-of-range. Another example is a menu element with a value of "E" that happens to be presented in a popup menu that only has choices "A", "B" and "C".
MDN The :in-rangeCSSpseudo-class represents an <input> element whose current value is within the range limits specified by the min and max attributes.
Spec If an element that could match :checked or :unchecked is neither "on" nor "off", the :indeterminate pseudo-class applies. :indeterminate also matches elements which do not have a notion of being "checked", but whose "value" is still in an indeterminate state, such as a progress meter whose progress percentage is unknown.
MDN The :indeterminateCSSpseudo-class represents any form element whose state is indeterminate, such as checkboxes that have been set to an indeterminate state with JavaScript, radio buttons which are members of a group in which all radio buttons are unchecked, and <progress> elements with no value attribute.
Spec The :interest-source pseudo-class applies to an interest source element that the user is currently showing interest in, and the :interest-target pseudo-class applies to the associated interest target of an element matching :interest-source.
Spec The :interest-source pseudo-class applies to an interest source element that the user is currently showing interest in, and the :interest-target pseudo-class applies to the associated interest target of an element matching :interest-source.
MDN The :interest-targetCSSpseudo-class represents the target element associated with an interest invoker when interest is shown on that invoker.
SelectorBaseline: widely availablesince January 2018
Spec An element is :valid or :invalid when its contents or value is, respectively, valid or invalid with respect to data validity semantics defined by the document language (e.g. [XFORMS11] or [HTML]). An element which lacks data validity semantics is neither :valid nor :invalid.
Spec The matches-any pseudo-class, :is(), is a functional pseudo-class taking a <forgiving-selector-list> as its sole argument.
MDN The :is()CSSpseudo-class function takes a selector list as its argument, and selects any element that can be selected by one of the selectors in that list. This is useful for writing large selectors in a more compact form.
SelectorBaseline: widely availablesince January 2018
Spec If the document language specifies how the (human) content language of an element is determined, it is possible to write selectors that represent an element based on its content language. The :lang() pseudo-class, which accepts a comma-separated list of one or more language ranges, represents an element whose content language is one of the languages listed in its argument. Each language range in :lang() is an extended language range, as defined in BCP 47, and must be a valid CSS <ident> or <string>. (Thus language ranges containing asterisks, for example, must be either correctly escaped or quoted as strings, e.g. :lang(\*-Latn) or :lang("*-Latn").)
MDN The :lang()CSSpseudo-class matches elements based on the language they are determined to be in.
Live previewExample from MDN
*:lang(en-US) { outline: 2px solid deeppink;}
<p lang="en-US"> Music during road trips and long commutes aren't a problem, but using headphones isn't the best thing to do while driving in your car.</p><p lang="pl-PL"> Gdy widzimy znak z narysowaną czaszką i napisem <strong lang="en-US">DANGER</strong> to lepiej nie wchodzić do środka.</p>
Browser support
First browser version supporting :lang()
Chrome
1
Edge
12
Firefox
1
Safari
3.1
Chrome Android
18
Safari iOS
2
First version with support, from MDN browser-compat-data.
Spec User agents commonly display unvisited hyperlinks differently from previously visited ones. Selectors provides the pseudo-classes :link and :visited to distinguish them:
MDN The :linkCSSpseudo-class represents an element that has not yet been visited. It matches every unvisited <a> or <area> element that has an href attribute.
Live previewExample from MDN
p { font-weight: bold;}a:link { color: forestgreen; text-decoration-color: hotpink;}
<p>Pages that you might have visited:</p><ul> <li> <a href="https://developer.mozilla.org">MDN Web Docs</a> </li> <li> <a href="https://www.youtube.com/">YouTube</a> </li></ul><p>Pages unlikely to be in your history:</p><ul> <li> <a href="https://developer.mozilla.org/missing-2">Random MDN page</a> </li> <li> <a href="https://example.com/missing-2">Random Example page</a> </li></ul>
Syntax
:link
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 :link
Chrome
1
Edge
12
Firefox
1
Safari
1
Chrome Android
18
Safari iOS
3.2
First version with support, from MDN browser-compat-data.
Spec The :local-link pseudo-class allows authors to style hyperlinks based on the users current location within a site and to differentiate site-internal versus site-external links.
MDN The :local-linkCSSpseudo-class represents a link to the same document. Therefore an element that is the source anchor of a hyperlink whose target's absolute URL matches the element's own document URL.
Syntax
:local-link
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Spec As previous drafts of this specification used the name :matches() for this pseudo-class, UAs may additionally implement this obsolete name as a legacy selector alias for :is() if needed for backwards-compatibility.
SelectorBaseline: widely availablesince March 2025
Spec The :modal pseudo-class represents an element which is in a state that excludes all interaction with elements outside it until it has been dismissed. Multiple elements can be :modal simultaneously, with only one of them active (able to receive input).
MDN The :modalCSSpseudo-class matches an element that is in a state in which it excludes all interaction with elements outside it until the interaction has been dismissed. Multiple elements can be selected by the :modal pseudo-class at the same time, but only one of them will be active and able to receive input.
<p>Would you like to see a new random number?</p><button id="showNumber">Show me</button><dialog id="favDialog"> <form method="dialog"> <p>Lucky number is: <strong id="number"></strong></p> <button>Close dialog</button> </form></dialog>
Spec The :muted pseudo-class represents an element that is capable of making sound, but is currently “muted“ (forced silent). (For the audio and video elements of HTML, see muted. [HTML])
MDN The :mutedCSSpseudo-class selector represents an element that is capable of making sound, such as <audio> or <video>, but is muted (forced silent).
Syntax
:muted
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 :muted
Chrome
158
Edge
158
Firefox
150
Safari
15.4
Chrome Android
158
Safari iOS
15.4
First version with support, from MDN browser-compat-data.
Spec The negation pseudo-class, :not(), is a functional pseudo-class taking a <complex-real-selector-list> as an argument. It represents an element that is not represented by its argument.
MDN The :not()CSSpseudo-class represents elements that do not match a list of selectors. Since it prevents specific items from being selected, it is known as the negation pseudo-class.
<p> <b>Mars</b> is one of the most Earth-like planets. <b>Mars</b> day is almost the same as an Earth day, only <strong>37 minutes</strong> longer.</p><p class="irrelevant"> <b class="important">NASA</b>'s Jet <del>Momentum</del> Propulsion Laboratory is designing mission concepts to survive the <b>Venus</b> extreme temperatures and atmospheric pressure.</p>
Browser support
First browser version supporting :not()
Chrome
1
Edge
12
Firefox
1
Safari
3.1
Chrome Android
18
Safari iOS
2
First version with support, from MDN browser-compat-data.
MDN The :nth-child()CSSpseudo-class matches elements based on the indexes of the elements in the child list of their parents. In other words, the :nth-child() selector selects child elements according to their position among all the sibling elements within a parent element.
SelectorBaseline: widely availablesince January 2018
Spec The :only-child pseudo-class represents an element that has no siblings. Same as :first-child:last-child or :nth-child(1):nth-last-child(1), but with a lower specificity.
MDN The :only-childCSSpseudo-class represents an element without any siblings. This is the same as :first-child:last-child or :nth-child(1):nth-last-child(1), but with a lower specificity.
<p>Stars expected to attend:</p><ol> <li>Robert Downey, Jr.</li></ol><p>Stars yet to confirm:</p><ol> <li>Scarlett Johansson</li> <li>Samuel L. Jackson</li> <li>Chris Pratt</li></ol><p>The ceremony is going to be held in <b>The Dolby Theatre</b>.</p>
Syntax
:only-child
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 :only-child
Chrome
2
Edge
12
Firefox
1.5
Safari
3.1
Chrome Android
18
Safari iOS
2
First version with support, from MDN browser-compat-data.
<p> To find out more about <b>QUIC</b>, check <a href="#">RFC 9000</a> and <a href="#">RFC 9114</a>.</p><dl> <dt>Published</dt> <dd>2021</dd> <dd>2022</dd></dl><p>Details about <b>QPACK</b> can be found in <a href="#">RFC 9204</a>.</p><dl> <dt>Published</dt> <dd>2022</dd></dl>
Syntax
:only-of-type
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 :only-of-type
Chrome
1
Edge
12
Firefox
3.5
Safari
3.1
Chrome Android
18
Safari iOS
2
First version with support, from MDN browser-compat-data.
<details> <summary>Details</summary> Lorem ipsum dolor sit amet, consectetur adipiscing elit. In pulvinar dapibus lacus, sit amet finibus lectus mollis eu. Nullam quis orci dictum, porta lacus et, cursus nunc. Aenean pulvinar imperdiet neque fermentum facilisis. Nulla facilisi. Curabitur vitae sapien ut nunc pulvinar semper vitae vitae nisi.</details><hr /><label for="pet-select">Choose a pet:</label><select id="pet-select"> <option value="dog">Dog</option> <option value="cat">Cat</option> <option value="hamster">Hamster</option></select><hr /><label for="start">Start date:</label><input type="date" id="start" />
Syntax
:open
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 :open
Chrome
133
Edge
133
Firefox
136
Safari
26.5
Chrome Android
133
Safari iOS
26.5
First version with support, from MDN browser-compat-data.
SelectorBaseline: widely availablesince January 2018
Spec A form element is :required or :optional if a value for it is, respectively, required or optional before the form it belongs to can be validly submitted. Elements that are not form elements are neither required nor optional.
SelectorBaseline: widely availablesince January 2018
Spec The :in-range and :out-of-range pseudo-classes apply only to elements that have range limitations. An element is :in-range or :out-of-range when the value that the element is bound to is in range or out of range with respect to its range limits as defined by the document language. An element that lacks data range limits or is not a form control is neither :in-range nor :out-of-range. E.g. a slider element with a value of 11 presented as a slider control that only represents the values from 1-10 is :out-of-range. Another example is a menu element with a value of "E" that happens to be presented in a popup menu that only has choices "A", "B" and "C".
MDN The :out-of-rangeCSSpseudo-class represents an <input> element whose current value is outside the range limits specified by the min and max attributes.
Spec The :past pseudo-class represents any element that is defined to occur entirely prior to a :current element. For example, the WebVTT spec defines the :past pseudo-class relative to the current playback position of a media element. If a time-based order of elements is not defined by the document language, then this represents any element that is a (possibly indirect) previous sibling of a :current element.
MDN The :pastCSSpseudo-class selector is a time-dimensional pseudo-class that will match for any element which appears entirely before an element that matches :current. For example in a video with captions which are being displayed by WebVTT.
Syntax
:past
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 :past
Chrome
23
Edge
79
Firefox
No
Safari
7
Chrome Android
25
Safari iOS
7
First version with support, from MDN browser-compat-data.
Spec The :paused pseudo-class represents an element that is capable of being “played” or “paused”, when that element is “paused” (i.e. not ”playing”). (This includes both an explicit “paused” state, and other non-playing states like “loaded, hasn’t been activated yet”, etc.)
MDN The :pausedCSSpseudo-class selector represents an element that is playable, such as <audio> or <video>, when that element is "paused" (i.e., not "playing").
Syntax
:paused
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 :paused
Chrome
158
Edge
158
Firefox
150
Safari
15.4
Chrome Android
158
Safari iOS
15.4
First version with support, from MDN browser-compat-data.
Spec The :picture-in-picture pseudo-class represents an element whose contents are being displayed in a “picture-in-picture” mode (i.e. displayed in a window confined to part of the screen and overlaying other content) rather than embedded in the document. For example, this pseudo-class can be used to style a video element’s box while its contents are being played in an overlaid window using the Picture-in-Picture API. [picture-in-picture]
MDN The :picture-in-pictureCSSpseudo-class matches the element which is currently in picture-in-picture mode.
Syntax
:picture-in-picture
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 :picture-in-picture
Chrome
110
Edge
110
Firefox
153
Safari
13.1
Chrome Android
110
Safari iOS
13.4
First version with support, from MDN browser-compat-data.
Spec Input elements can sometimes show placeholder text as a hint to the user on what to type in. See, for example, the placeholder attribute in [HTML]. The :placeholder-shown pseudo-class matches an input element that is showing such placeholder text, whether that text is given by an attribute or a real element, or is otherwise implied by the UA.
Spec The :playing pseudo-class represents an element that is capable of being “played” or “paused”, when that element is “playing”. (This includes both when the element is explicitly playing, and when it’s temporarily stopped for some reason not connected to user intent, but will automatically resume when that reason is resolved, such as a “buffering” or “stalled” state.)
MDN The :playingCSSpseudo-class selector represents the playback state of an element that is playable, such as <audio> or <video>, when that element is "playing". An element is considered to be playing if it is currently playing the media resource, or if it has temporarily stopped for reasons other than user intent (such as :buffering or :stalled).
Syntax
:playing
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 :playing
Chrome
158
Edge
158
Firefox
150
Safari
15.4
Chrome Android
158
Safari iOS
15.4
First version with support, from MDN browser-compat-data.
Spec The :popover-open pseudo-class represents an element that has both “popover-showing” and “popover-hidden” states and which is currently in the “popover-showing” state.
MDN The :popover-openCSSpseudo-class represents a Popover API element (i.e., one with a popover attribute) that is in the showing state. You can use this to apply style to popover elements only when they are shown.
Syntax
:popover-open
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 :popover-open
Chrome
114
Edge
114
Firefox
125
Safari
17
Chrome Android
114
Safari iOS
17
First version with support, from MDN browser-compat-data.
SelectorBaseline: widely availablesince January 2023
Spec An element matches :read-write if it is user-alterable, as defined by the document language. Otherwise, it is :read-only.
MDN The :read-onlyCSSpseudo-class selects elements (such as certain <input> types and <textarea>) that are not editable by the user. Elements on which the HTML attribute readonly doesn't have an effect (such as <input type="radio">, <input type="checkbox">, and all other non-form elements) are also selected by the :read-only pseudo-class. In fact, :read-only matches anything that :read-write doesn't match, making it equivalent to :not(:read-write).
SelectorBaseline: widely availablesince January 2018
Spec A form element is :required or :optional if a value for it is, respectively, required or optional before the form it belongs to can be validly submitted. Elements that are not form elements are neither required nor optional.
SelectorBaseline: widely availablesince January 2018
Spec The :root pseudo-class represents an element that is the root of the document.
MDN The :rootCSSpseudo-class matches the root element of a tree representing the document. In HTML, :root represents the <html> element and is identical to the selector html, except that its specificity (0-1-0) is higher than html's (0-0-1).
Syntax
:root
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 :root
Chrome
1
Edge
12
Firefox
1
Safari
1
Chrome Android
18
Safari iOS
1
First version with support, from MDN browser-compat-data.
Spec In some contexts, selectors are matched with respect to one or more scoping roots, such as when calling the querySelector() method in [DOM]. The :scope pseudo-class represents this scoping root, and may be either a true element or a virtual one (such as a DocumentFragment).
MDN The :scopeCSSpseudo-class represents elements that are a reference point, or scope, for selectors to match against.
Live previewExample from MDN
div { padding: 10px;}@scope (.light-scheme) { :scope { background-color: plum; } a { color: indigo; }}@scope (.dark-scheme) { :scope { background-color: indigo; color: antiquewhite; } a { color: plum; }}
<div class="light-scheme"> <p> MDN contains lots of information about <a href="/en-US/docs/Web/HTML">HTML</a>, <a href="/en-US/docs/Web/CSS">CSS</a>, and <a href="/en-US/docs/Web/JavaScript">JavaScript</a>. </p></div><div class="dark-scheme"> <p> MDN contains lots of information about <a href="/en-US/docs/Web/HTML">HTML</a>, <a href="/en-US/docs/Web/CSS">CSS</a>, and <a href="/en-US/docs/Web/JavaScript">JavaScript</a>. </p></div>
Syntax
:scope
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 :scope
Chrome
27
Edge
79
Firefox
32
Safari
7
Chrome Android
27
Safari iOS
7
First version with support, from MDN browser-compat-data.
Spec The :seeking pseudo-class represents an element that is capable of ”seeking” when that element is ”seeking”. (For the audio and video elements of HTML, see HTML § 4.8.11.9 Seeking.)
MDN The :seekingCSSpseudo-class selector represents an element that is playable, such as <audio> or <video>, when the playable element is seeking a playback position in the media resource. A resource is considered to be seeking if the user has requested playback of a specific position in the media resource, but the media element has not yet reached that position.
Syntax
:seeking
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 :seeking
Chrome
158
Edge
158
Firefox
150
Safari
15.4
Chrome Android
158
Safari iOS
15.4
First version with support, from MDN browser-compat-data.
Spec The :stalled pseudo-class represents an element when that element cannot continue playing because it is actively attempting to obtain media data but it has failed to receive any data for some amount of time. For the audio and video elements of HTML, this amount of time is the media element stall timeout. [HTML] (Note that, like with the :buffering pseudo-class, the element is still considered to be “playing” when it is “stalled”. Whenever :stalled matches an element, :playing also matches the element.)
MDN The :stalledCSSpseudo-class selector represents an element that is playable, such as <audio> or <video>, when playback is stalled. A resource is considered to be stalled if the user has requested playback of a specific position in the media resource, but it has failed to receive any data for some amount of time. This is different from :buffering in that the media element is unexpectedly not loading data when stalled (e.g., due to a network error) for around 3 seconds (the exact time is user agent dependent).
Syntax
:stalled
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 :stalled
Chrome
158
Edge
158
Firefox
150
Safari
15.4
Chrome Android
158
Safari iOS
15.4
First version with support, from MDN browser-compat-data.
SelectorBaseline: widely availablesince January 2018
Spec The :target pseudo-class matches the document’s target elements. If the document’s URL has no fragment identifier, then the document has no target elements.
MDN The :targetCSSpseudo-class selects the target element of the document. When the document is loaded, the target element is derived using the document's URL fragment identifier.
Live previewExample from MDN
p:target { background-color: gold;}/* Add a pseudo-element inside the target element */p:target::before { font: 70% sans-serif; content: "►"; color: limegreen; margin-right: 0.25em;}/* Style italic elements within the target element */p:target i { color: red;}
<h3>Table of Contents</h3><ol> <li><a href="#p1">Jump to the first paragraph!</a></li> <li><a href="#p2">Jump to the second paragraph!</a></li> <li> <a href="#nowhere"> This link goes nowhere, because the target doesn't exist. </a> </li></ol><h3>My Fun Article</h3><p id="p1"> You can target <i>this paragraph</i> using a URL fragment. Click on the first link above to try out!</p><p id="p2"> This is <i>another paragraph</i>, also accessible from the second link above. Isn't that delightful?</p>
Syntax
:target
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
Chrome
1
Edge
12
Firefox
1
Safari
1.3
Chrome Android
18
Safari iOS
2
First version with support, from MDN browser-compat-data.
Spec When such elements are toggled “on” the :checked pseudo-class applies. For example, [HTML] defines that checked checkboxes, radio buttons, and selected <option> elements match :checked. Similarly, when such elements are toggled “off”, the :unchecked pseudo-class applies.
Syntax
:unchecked
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Spec The :user-invalid and the :user-valid pseudo-classes represent an element with incorrect or correct input, respectively, but only after the user has significantly interacted with it. Their purpose is to help the user identify mistakes in their input.
MDN The :user-invalidCSSpseudo-class represents any validated form element whose value isn't valid based on their validation constraints, after the user has interacted with it.
Spec The :user-invalid and the :user-valid pseudo-classes represent an element with incorrect or correct input, respectively, but only after the user has significantly interacted with it. Their purpose is to help the user identify mistakes in their input.
MDN The :user-validCSSpseudo-class represents any validated form element whose value validates correctly based on its validation constraints. However, unlike :valid it only matches once the user has interacted with it.
SelectorBaseline: widely availablesince January 2018
Spec An element is :valid or :invalid when its contents or value is, respectively, valid or invalid with respect to data validity semantics defined by the document language (e.g. [XFORMS11] or [HTML]). An element which lacks data validity semantics is neither :valid nor :invalid.
MDN The :validCSSpseudo-class represents any <input> or other <form> element whose contents validate successfully. This allows you to easily make valid fields adopt an appearance that helps the user confirm that their data is formatted properly.
Spec User agents commonly display unvisited hyperlinks differently from previously visited ones. Selectors provides the pseudo-classes :link and :visited to distinguish them:
MDN The :visitedCSSpseudo-class applies once the link has been visited by the user. For privacy reasons, the styles that can be modified using this selector are very limited. The :visited pseudo-class applies only to <a> and <area> elements that have an href attribute.
Live previewExample from MDN
p { font-weight: bold;}a:visited { color: forestgreen; text-decoration-color: hotpink;}
<p>Pages that you might have visited:</p><ul> <li> <a href="https://developer.mozilla.org">MDN Web Docs</a> </li> <li> <a href="https://www.youtube.com/">YouTube</a> </li></ul><p>Pages unlikely to be in your history:</p><ul> <li> <a href="https://developer.mozilla.org/missing-1">Random MDN page</a> </li> <li> <a href="https://example.com/missing-1">Random Example page</a> </li></ul>
Syntax
:visited
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 :visited
Chrome
1
Edge
12
Firefox
1
Safari
1
Chrome Android
18
Safari iOS
1
First version with support, from MDN browser-compat-data.
Spec The :volume-locked pseudo-class represents an element that is capable of making sound, and currently has its volume "locked" by the UA or the user, so the page author cannot change it. (For the audio and video elements of HTML, see the algorithm for setting the element’s effective media volume. [HTML])
MDN The :volume-lockedCSSpseudo-class selector represents an element that is capable of making sound, such as <audio> or <video>, but the audio volume of the media element is currently "locked" by the user.
Syntax
:volume-locked
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 :volume-locked
Chrome
158
Edge
158
Firefox
150
Safari
15.4
Chrome Android
158
Safari iOS
15.4
First version with support, from MDN browser-compat-data.
Spec The Specificity-adjustment pseudo-class, :where(), is a functional pseudo-class with the same syntax and functionality as :is(). Unlike :is(), neither the :where() pseudo-class, nor any of its arguments, contribute to the specificity of the selector—its specificity is always zero.
MDN The :where()CSSpseudo-class function takes a selector list as its argument, and selects any element that can be selected by one of the selectors in that list.
Live previewExample from MDN
ol { list-style-type: upper-alpha; color: darkblue;}/* Not applied to ol, because of lower specificity */:where(ol, ul, menu:unsupported) :where(ol, ul) { color: green;}:where(ol, ul) :where(ol, ul) ol { list-style-type: lower-greek; color: chocolate;}
Spec The next-sibling combinator is made of the “plus sign” (U+002B, +) code point that separates two compound selectors. The elements represented by the two compound selectors share the same parent in the document tree and the element represented by the first compound selector immediately precedes the element represented by the second one. Non-element nodes (e.g. text between elements) are ignored when considering the adjacency of elements.
Syntax
'+'
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Spec A child combinator describes a childhood relationship between two elements. A child combinator is made of the "greater-than sign" (U+003E, >) code point and separates two compound selectors.
Syntax
'>'
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Spec The column combinator, which consists of two pipes (||) represents the relationship of a column element to a cell element belonging to the column it represents. Column membership is determined based on the semantics of the document language only: whether and how the elements are presented is not considered. If a cell element belongs to more than one column, it is represented by a selector indicating membership in any of those columns.
Syntax
'|' '|'
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Spec The subsequent-sibling combinator is made of the "tilde" (U+007E, ~) code point that separates two compound selectors. The elements represented by the two compound selectors share the same parent in the document tree and the element represented by the first compound selector precedes (not necessarily immediately) the element represented by the second one.
Syntax
'~'
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.