CINXE.COM
Selectors Level 4
<!doctype html><html lang="en"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport"> <title>Selectors Level 4</title> <meta content="ED" name="w3c-status"> <link href="https://www.w3.org/StyleSheets/TR/2021/W3C-ED" rel="stylesheet"> <meta content="Bikeshed version 742f3d674, updated Mon Nov 4 14:56:54 2024 -0800" name="generator"> <link href="https://www.w3.org/TR/selectors-4/" rel="canonical"> <link href="https://drafts.csswg.org/csslogo.ico" rel="icon"> <meta content="1f4e5de6538eeaed2378d127300a62f95146562f" name="revision"> <meta content="dark light" name="color-scheme"> <link href="https://www.w3.org/StyleSheets/TR/2021/dark.css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css"> <style> #selector-examples td:first-child { white-space: nowrap; } </style> <style>/* Boilerplate: style-autolinks */ .css.css, .property.property, .descriptor.descriptor { color: var(--a-normal-text); font-size: inherit; font-family: inherit; } .css::before, .property::before, .descriptor::before { content: "‘"; } .css::after, .property::after, .descriptor::after { content: "’"; } .property, .descriptor { /* Don't wrap property and descriptor names */ white-space: nowrap; } .type { /* CSS value <type> */ font-style: italic; } pre .property::before, pre .property::after { content: ""; } [data-link-type="property"]::before, [data-link-type="propdesc"]::before, [data-link-type="descriptor"]::before, [data-link-type="value"]::before, [data-link-type="function"]::before, [data-link-type="at-rule"]::before, [data-link-type="selector"]::before, [data-link-type="maybe"]::before { content: "‘"; } [data-link-type="property"]::after, [data-link-type="propdesc"]::after, [data-link-type="descriptor"]::after, [data-link-type="value"]::after, [data-link-type="function"]::after, [data-link-type="at-rule"]::after, [data-link-type="selector"]::after, [data-link-type="maybe"]::after { content: "’"; } [data-link-type].production::before, [data-link-type].production::after, .prod [data-link-type]::before, .prod [data-link-type]::after { content: ""; } [data-link-type=element], [data-link-type=element-attr] { font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace; font-size: .9em; } [data-link-type=element]::before { content: "<" } [data-link-type=element]::after { content: ">" } [data-link-type=biblio] { white-space: pre; } @media (prefers-color-scheme: dark) { :root { --selflink-text: black; --selflink-bg: silver; --selflink-hover-text: white; } } </style> <style>/* Boilerplate: style-colors */ /* Any --*-text not paired with a --*-bg is assumed to have a transparent bg */ :root { color-scheme: light dark; --text: black; --bg: white; --unofficial-watermark: url(https://www.w3.org/StyleSheets/TR/2016/logos/UD-watermark); --logo-bg: #1a5e9a; --logo-active-bg: #c00; --logo-text: white; --tocnav-normal-text: #707070; --tocnav-normal-bg: var(--bg); --tocnav-hover-text: var(--tocnav-normal-text); --tocnav-hover-bg: #f8f8f8; --tocnav-active-text: #c00; --tocnav-active-bg: var(--tocnav-normal-bg); --tocsidebar-text: var(--text); --tocsidebar-bg: #f7f8f9; --tocsidebar-shadow: rgba(0,0,0,.1); --tocsidebar-heading-text: hsla(203,20%,40%,.7); --toclink-text: var(--text); --toclink-underline: #3980b5; --toclink-visited-text: var(--toclink-text); --toclink-visited-underline: #054572; --heading-text: #005a9c; --hr-text: var(--text); --algo-border: #def; --del-text: red; --del-bg: transparent; --ins-text: #080; --ins-bg: transparent; --a-normal-text: #034575; --a-normal-underline: #bbb; --a-visited-text: var(--a-normal-text); --a-visited-underline: #707070; --a-hover-bg: rgba(75%, 75%, 75%, .25); --a-active-text: #c00; --a-active-underline: #c00; --blockquote-border: silver; --blockquote-bg: transparent; --blockquote-text: currentcolor; --issue-border: #e05252; --issue-bg: #fbe9e9; --issue-text: var(--text); --issueheading-text: #831616; --example-border: #e0cb52; --example-bg: #fcfaee; --example-text: var(--text); --exampleheading-text: #574b0f; --note-border: #52e052; --note-bg: #e9fbe9; --note-text: var(--text); --noteheading-text: hsl(120, 70%, 30%); --notesummary-underline: silver; --assertion-border: #aaa; --assertion-bg: #eee; --assertion-text: black; --advisement-border: orange; --advisement-bg: #fec; --advisement-text: var(--text); --advisementheading-text: #b35f00; --warning-border: red; --warning-bg: hsla(40,100%,50%,0.95); --warning-text: var(--text); --amendment-border: #330099; --amendment-bg: #F5F0FF; --amendment-text: var(--text); --amendmentheading-text: #220066; --def-border: #8ccbf2; --def-bg: #def; --def-text: var(--text); --defrow-border: #bbd7e9; --datacell-border: silver; --indexinfo-text: #707070; --indextable-hover-text: black; --indextable-hover-bg: #f7f8f9; --outdatedspec-bg: rgba(0, 0, 0, .5); --outdatedspec-text: black; --outdated-bg: maroon; --outdated-text: white; --outdated-shadow: red; --editedrec-bg: darkorange; } @media (prefers-color-scheme: dark) { :root { --text: #ddd; --bg: black; --unofficial-watermark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cg fill='%23100808' transform='translate(200 200) rotate(-45) translate(-200 -200)' stroke='%23100808' stroke-width='3'%3E%3Ctext x='50%25' y='220' style='font: bold 70px sans-serif; text-anchor: middle; letter-spacing: 6px;'%3EUNOFFICIAL%3C/text%3E%3Ctext x='50%25' y='305' style='font: bold 70px sans-serif; text-anchor: middle; letter-spacing: 6px;'%3EDRAFT%3C/text%3E%3C/g%3E%3C/svg%3E"); --logo-bg: #1a5e9a; --logo-active-bg: #c00; --logo-text: white; --tocnav-normal-text: #999; --tocnav-normal-bg: var(--bg); --tocnav-hover-text: var(--tocnav-normal-text); --tocnav-hover-bg: #080808; --tocnav-active-text: #f44; --tocnav-active-bg: var(--tocnav-normal-bg); --tocsidebar-text: var(--text); --tocsidebar-bg: #080808; --tocsidebar-shadow: rgba(255,255,255,.1); --tocsidebar-heading-text: hsla(203,20%,40%,.7); --toclink-text: var(--text); --toclink-underline: #6af; --toclink-visited-text: var(--toclink-text); --toclink-visited-underline: #054572; --heading-text: #8af; --hr-text: var(--text); --algo-border: #456; --del-text: #f44; --del-bg: transparent; --ins-text: #4a4; --ins-bg: transparent; --a-normal-text: #6af; --a-normal-underline: #555; --a-visited-text: var(--a-normal-text); --a-visited-underline: var(--a-normal-underline); --a-hover-bg: rgba(25%, 25%, 25%, .2); --a-active-text: #f44; --a-active-underline: var(--a-active-text); --borderedblock-bg: rgba(255, 255, 255, .05); --blockquote-border: silver; --blockquote-bg: var(--borderedblock-bg); --blockquote-text: currentcolor; --issue-border: #e05252; --issue-bg: var(--borderedblock-bg); --issue-text: var(--text); --issueheading-text: hsl(0deg, 70%, 70%); --example-border: hsl(50deg, 90%, 60%); --example-bg: var(--borderedblock-bg); --example-text: var(--text); --exampleheading-text: hsl(50deg, 70%, 70%); --note-border: hsl(120deg, 100%, 35%); --note-bg: var(--borderedblock-bg); --note-text: var(--text); --noteheading-text: hsl(120, 70%, 70%); --notesummary-underline: silver; --assertion-border: #444; --assertion-bg: var(--borderedblock-bg); --assertion-text: var(--text); --advisement-border: orange; --advisement-bg: #222218; --advisement-text: var(--text); --advisementheading-text: #f84; --warning-border: red; --warning-bg: hsla(40,100%,20%,0.95); --warning-text: var(--text); --amendment-border: #330099; --amendment-bg: #080010; --amendment-text: var(--text); --amendmentheading-text: #cc00ff; --def-border: #8ccbf2; --def-bg: #080818; --def-text: var(--text); --defrow-border: #136; --datacell-border: silver; --indexinfo-text: #aaa; --indextable-hover-text: var(--text); --indextable-hover-bg: #181818; --outdatedspec-bg: rgba(255, 255, 255, .5); --outdatedspec-text: black; --outdated-bg: maroon; --outdated-text: white; --outdated-shadow: red; --editedrec-bg: darkorange; } /* In case a transparent-bg image doesn't expect to be on a dark bg, which is quite common in practice... */ img { background: white; } } </style> <style>/* Boilerplate: style-counters */ body { counter-reset: example figure issue; } .issue { counter-increment: issue; } .issue:not(.no-marker)::before { content: "Issue " counter(issue); } .example { counter-increment: example; } .example:not(.no-marker)::before { content: "Example " counter(example); } .invalid.example:not(.no-marker)::before, .illegal.example:not(.no-marker)::before { content: "Invalid Example" counter(example); } figcaption { counter-increment: figure; } figcaption:not(.no-marker)::before { content: "Figure " counter(figure) " "; } </style> <style>/* Boilerplate: style-dfn-panel */ :root { --dfnpanel-bg: #ddd; --dfnpanel-text: var(--text); --dfnpanel-target-bg: #ffc; --dfnpanel-target-outline: orange; } @media (prefers-color-scheme: dark) { :root { --dfnpanel-bg: #222; --dfnpanel-text: var(--text); --dfnpanel-target-bg: #333; --dfnpanel-target-outline: silver; } } .dfn-panel { position: absolute; z-index: 35; width: 20em; width: 300px; height: auto; max-height: 500px; overflow: auto; padding: 0.5em 0.75em; font: small Helvetica Neue, sans-serif, Droid Sans Fallback; background: var(--dfnpanel-bg); color: var(--dfnpanel-text); border: outset 0.2em; white-space: normal; /* in case it's moved into a pre */ } .dfn-panel:not(.on) { display: none; } .dfn-panel * { margin: 0; padding: 0; text-indent: 0; } .dfn-panel > b { display: block; } .dfn-panel a { color: var(--dfnpanel-text); } .dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; } .dfn-panel a:focus { outline: 5px auto Highlight; outline: 5px auto -webkit-focus-ring-color; } .dfn-panel > b + b { margin-top: 0.25em; } .dfn-panel ul { padding: 0 0 0 1em; list-style: none; } .dfn-panel li a { max-width: calc(300px - 1.5em - 1em); overflow: hidden; text-overflow: ellipsis; } .dfn-panel.activated { display: inline-block; position: fixed; left: 8px; bottom: 2em; margin: 0 auto; max-width: calc(100vw - 1.5em - .4em - .5em); max-height: 30vh; transition: left 1s ease-out, bottom 1s ease-out; } .dfn-panel .link-item:hover { text-decoration: underline; } .dfn-panel .link-item .copy-icon { opacity: 0; } .dfn-panel .link-item:hover .copy-icon, .dfn-panel .link-item .copy-icon:focus { opacity: 1; } .dfn-panel .copy-icon { display: inline-block; margin-right: 0.5em; width: 0.85em; height: 1em; border-radius: 3px; background-color: #ccc; cursor: pointer; } .dfn-panel .copy-icon .icon { width: 100%; height: 100%; background-color: #fff; display: flex; justify-content: center; align-items: center; position: relative; } .dfn-panel .copy-icon .icon::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 1px solid black; background-color: #ccc; opacity: 0.25; transform: translate(3px, -3px); } .dfn-panel .copy-icon:active .icon::before { opacity: 1; } .dfn-paneled[role="button"] { cursor: help; } .highlighted { animation: target-fade 3s; } @keyframes target-fade { from { background-color: var(--dfnpanel-target-bg); outline: 5px solid var(--dfnpanel-target-outline); } to { color: var(--a-normal-text); background-color: transparent; outline: transparent; } } </style> <style>/* Boilerplate: style-issues */ a[href].issue-return { float: right; float: inline-end; color: var(--issueheading-text); font-weight: bold; text-decoration: none; } </style> <style>/* Boilerplate: style-md-lists */ /* This is a weird hack for me not yet following the commonmark spec regarding paragraph and lists. */ [data-md] > :first-child { margin-top: 0; } [data-md] > :last-child { margin-bottom: 0; } </style> <style>/* Boilerplate: style-mdn-anno */ :root { --mdn-bg: #EEE; --mdn-shadow: #999; --mdn-nosupport-text: #ccc; --mdn-pass: green; --mdn-fail: red; } @media (prefers-color-scheme: dark) { :root { --mdn-bg: #222; --mdn-shadow: #444; --mdn-nosupport-text: #666; --mdn-pass: #690; --mdn-fail: #d22; } } .mdn-anno { background: var(--mdn-bg, #EEE); border-radius: .25em; box-shadow: 0 0 3px var(--mdn-shadow, #999); color: var(--text, black); font: 1em sans-serif; hyphens: none; max-width: min-content; overflow: hidden; padding: 0.2em; position: absolute; right: 0.3em; top: auto; white-space: nowrap; word-wrap: normal; z-index: 8; } .mdn-anno.unpositioned { display: none; } .mdn-anno.overlapping-main { opacity: .2; transition: opacity .1s; } .mdn-anno[open] { opacity: 1; z-index: 9; min-width: 9em; } .mdn-anno:hover { opacity: 1; outline: var(--text, black) 1px solid; } .mdn-anno > summary { font-weight: normal; text-align: right; cursor: pointer; display: block; } .mdn-anno > summary > .less-than-two-engines-flag { color: var(--mdn-fail); padding-right: 2px; } .mdn-anno > summary > .all-engines-flag { color: var(--mdn-pass); padding-right: 2px; } .mdn-anno > summary > span { color: #fff; background-color: #000; font-weight: normal; font-family: zillaslab, Palatino, "Palatino Linotype", serif; padding: 2px 3px 0px 3px; line-height: 1.3em; vertical-align: top; } .mdn-anno > .feature { margin-top: 20px; } .mdn-anno > .feature:not(:first-of-type) { border-top: 1px solid #999; margin-top: 6px; padding-top: 2px; } .mdn-anno > .feature > .less-than-two-engines-text { color: var(--mdn-fail); } .mdn-anno > .feature > .all-engines-text { color: var(--mdn-pass); } .mdn-anno > .feature > p { font-size: .75em; margin-top: 6px; margin-bottom: 0; } .mdn-anno > .feature > p + p { margin-top: 3px; } .mdn-anno > .feature > .support { display: block; font-size: 0.6em; margin: 0; padding: 0; margin-top: 2px; } .mdn-anno > .feature > .support + div { padding-top: 0.5em; } .mdn-anno > .feature > .support > hr { display: block; border: none; border-top: 1px dotted #999; padding: 3px 0px 0px 0px; margin: 2px 3px 0px 3px; } .mdn-anno > .feature > .support > hr::before { content: ""; } .mdn-anno > .feature > .support > span { padding: 0.2em 0; display: block; display: table; } .mdn-anno > .feature > .support > span.no { color: var(--mdn-nosupport-text); filter: grayscale(100%); } .mdn-anno > .feature > .support > span.no::before { opacity: 0.5; } .mdn-anno > .feature > .support > span:first-of-type { padding-top: 0.5em; } .mdn-anno > .feature > .support > span > span { padding: 0 0.5em; display: table-cell; } .mdn-anno > .feature > .support > span > span:first-child { width: 100%; } .mdn-anno > .feature > .support > span > span:last-child { width: 100%; white-space: pre; padding: 0; } .mdn-anno > .feature > .support > span::before { content: ' '; display: table-cell; min-width: 1.5em; height: 1.5em; background: no-repeat center center; background-size: contain; text-align: right; font-size: 0.75em; font-weight: bold; } .mdn-anno > .feature > .support > .chrome_android::before { background-image: url(https://resources.whatwg.org/browser-logos/chrome.svg); } .mdn-anno > .feature > .support > .firefox_android::before { background-image: url(https://resources.whatwg.org/browser-logos/firefox.png); } .mdn-anno > .feature > .support > .chrome::before { background-image: url(https://resources.whatwg.org/browser-logos/chrome.svg); } .mdn-anno > .feature > .support > .edge_blink::before { background-image: url(https://resources.whatwg.org/browser-logos/edge.svg); } .mdn-anno > .feature > .support > .edge::before { background-image: url(https://resources.whatwg.org/browser-logos/edge_legacy.svg); } .mdn-anno > .feature > .support > .firefox::before { background-image: url(https://resources.whatwg.org/browser-logos/firefox.png); } .mdn-anno > .feature > .support > .ie::before { background-image: url(https://resources.whatwg.org/browser-logos/ie.png); } .mdn-anno > .feature > .support > .safari_ios::before { background-image: url(https://resources.whatwg.org/browser-logos/safari-ios.svg); } .mdn-anno > .feature > .support > .nodejs::before { background-image: url(https://nodejs.org/static/images/favicons/favicon.ico); } .mdn-anno > .feature > .support > .opera_android::before { background-image: url(https://resources.whatwg.org/browser-logos/opera.svg); } .mdn-anno > .feature > .support > .opera::before { background-image: url(https://resources.whatwg.org/browser-logos/opera.svg); } .mdn-anno > .feature > .support > .safari::before { background-image: url(https://resources.whatwg.org/browser-logos/safari.png); } .mdn-anno > .feature > .support > .samsunginternet_android::before { background-image: url(https://resources.whatwg.org/browser-logos/samsung.svg); } .mdn-anno > .feature > .support > .webview_android::before { background-image: url(https://resources.whatwg.org/browser-logos/android-webview.png); } .name-slug-mismatch { color: red; } .caniuse-status:hover { z-index: 9; } /* dt, li, .issue, .note, and .example are "position: relative", so to put annotation at right margin, must move to right of containing block */; .h-entry:not(.status-LS) dt > .mdn-anno, .h-entry:not(.status-LS) li > .mdn-anno, .h-entry:not(.status-LS) .issue > .mdn-anno, .h-entry:not(.status-LS) .note > .mdn-anno, .h-entry:not(.status-LS) .example > .mdn-anno { right: -6.7em; } .h-entry p + .mdn-anno { margin-top: 0; } h2 + .mdn-anno.after { margin: -48px 0 0 0; } h3 + .mdn-anno.after { margin: -46px 0 0 0; } h4 + .mdn-anno.after { margin: -42px 0 0 0; } h5 + .mdn-anno.after { margin: -40px 0 0 0; } h6 + .mdn-anno.after { margin: -40px 0 0 0; } </style> <style>/* Boilerplate: style-ref-hints */ :root { --ref-hint-bg: #ddd; --ref-hint-text: var(--text); } @media (prefers-color-scheme: dark) { :root { --ref-hint-bg: #222; --ref-hint-text: var(--text); } } .ref-hint { display: inline-block; position: absolute; z-index: 35; width: 20em; width: 300px; height: auto; max-height: 500px; overflow: auto; padding: 0.5em 0.5em; font: small Helvetica Neue, sans-serif, Droid Sans Fallback; background: var(--ref-hint-bg); color: var(--ref-hint-text); border: outset 0.2em; white-space: normal; /* in case it's moved into a pre */ } .ref-hint * { margin: 0; padding: 0; text-indent: 0; } .ref-hint ul { padding: 0 0 0 1em; list-style: none; } </style> <style>/* Boilerplate: style-selflinks */ :root { --selflink-text: white; --selflink-bg: gray; --selflink-hover-text: black; } .heading, .issue, .note, .example, li, dt { position: relative; } a.self-link { position: absolute; top: 0; left: calc(-1 * (3.5rem - 26px)); width: calc(3.5rem - 26px); height: 2em; text-align: center; border: none; transition: opacity .2s; opacity: .5; } a.self-link:hover { opacity: 1; } .heading > a.self-link { font-size: 83%; } .example > a.self-link, .note > a.self-link, .issue > a.self-link { /* These blocks are overflow:auto, so positioning outside doesn't work. */ left: auto; right: 0; } li > a.self-link { left: calc(-1 * (3.5rem - 26px) - 2em); } dfn > a.self-link { top: auto; left: auto; opacity: 0; width: 1.5em; height: 1.5em; background: var(--selflink-bg); color: var(--selflink-text); font-style: normal; transition: opacity .2s, background-color .2s, color .2s; } dfn:hover > a.self-link { opacity: 1; } dfn > a.self-link:hover { color: var(--selflink-hover-text); } a.self-link::before { content: "¶"; } .heading > a.self-link::before { content: "§"; } dfn > a.self-link::before { content: "#"; } </style> <style>/* Boilerplate: style-syntax-highlighting */ code.highlight { padding: .1em; border-radius: .3em; } pre.highlight, pre > code.highlight { display: block; padding: 1em; margin: .5em 0; overflow: auto; border-radius: 0; } .highlight:not(.idl) { background: rgba(0, 0, 0, .03); } c-[a] { color: #990055 } /* Keyword.Declaration */ c-[b] { color: #990055 } /* Keyword.Type */ c-[c] { color: #708090 } /* Comment */ c-[d] { color: #708090 } /* Comment.Multiline */ c-[e] { color: #0077aa } /* Name.Attribute */ c-[f] { color: #669900 } /* Name.Tag */ c-[g] { color: #222222 } /* Name.Variable */ c-[k] { color: #990055 } /* Keyword */ c-[l] { color: #000000 } /* Literal */ c-[m] { color: #000000 } /* Literal.Number */ c-[n] { color: #0077aa } /* Name */ c-[o] { color: #999999 } /* Operator */ c-[p] { color: #999999 } /* Punctuation */ c-[s] { color: #a67f59 } /* Literal.String */ c-[t] { color: #a67f59 } /* Literal.String.Single */ c-[u] { color: #a67f59 } /* Literal.String.Double */ c-[cp] { color: #708090 } /* Comment.Preproc */ c-[c1] { color: #708090 } /* Comment.Single */ c-[cs] { color: #708090 } /* Comment.Special */ c-[kc] { color: #990055 } /* Keyword.Constant */ c-[kn] { color: #990055 } /* Keyword.Namespace */ c-[kp] { color: #990055 } /* Keyword.Pseudo */ c-[kr] { color: #990055 } /* Keyword.Reserved */ c-[ld] { color: #000000 } /* Literal.Date */ c-[nc] { color: #0077aa } /* Name.Class */ c-[no] { color: #0077aa } /* Name.Constant */ c-[nd] { color: #0077aa } /* Name.Decorator */ c-[ni] { color: #0077aa } /* Name.Entity */ c-[ne] { color: #0077aa } /* Name.Exception */ c-[nf] { color: #0077aa } /* Name.Function */ c-[nl] { color: #0077aa } /* Name.Label */ c-[nn] { color: #0077aa } /* Name.Namespace */ c-[py] { color: #0077aa } /* Name.Property */ c-[ow] { color: #999999 } /* Operator.Word */ c-[mb] { color: #000000 } /* Literal.Number.Bin */ c-[mf] { color: #000000 } /* Literal.Number.Float */ c-[mh] { color: #000000 } /* Literal.Number.Hex */ c-[mi] { color: #000000 } /* Literal.Number.Integer */ c-[mo] { color: #000000 } /* Literal.Number.Oct */ c-[sb] { color: #a67f59 } /* Literal.String.Backtick */ c-[sc] { color: #a67f59 } /* Literal.String.Char */ c-[sd] { color: #a67f59 } /* Literal.String.Doc */ c-[se] { color: #a67f59 } /* Literal.String.Escape */ c-[sh] { color: #a67f59 } /* Literal.String.Heredoc */ c-[si] { color: #a67f59 } /* Literal.String.Interpol */ c-[sx] { color: #a67f59 } /* Literal.String.Other */ c-[sr] { color: #a67f59 } /* Literal.String.Regex */ c-[ss] { color: #a67f59 } /* Literal.String.Symbol */ c-[vc] { color: #0077aa } /* Name.Variable.Class */ c-[vg] { color: #0077aa } /* Name.Variable.Global */ c-[vi] { color: #0077aa } /* Name.Variable.Instance */ c-[il] { color: #000000 } /* Literal.Number.Integer.Long */ @media (prefers-color-scheme: dark) { .highlight:not(.idl) { background: rgba(255, 255, 255, .05); } c-[a] { color: #d33682 } /* Keyword.Declaration */ c-[b] { color: #d33682 } /* Keyword.Type */ c-[c] { color: #2aa198 } /* Comment */ c-[d] { color: #2aa198 } /* Comment.Multiline */ c-[e] { color: #268bd2 } /* Name.Attribute */ c-[f] { color: #b58900 } /* Name.Tag */ c-[g] { color: #cb4b16 } /* Name.Variable */ c-[k] { color: #d33682 } /* Keyword */ c-[l] { color: #657b83 } /* Literal */ c-[m] { color: #657b83 } /* Literal.Number */ c-[n] { color: #268bd2 } /* Name */ c-[o] { color: #657b83 } /* Operator */ c-[p] { color: #657b83 } /* Punctuation */ c-[s] { color: #6c71c4 } /* Literal.String */ c-[t] { color: #6c71c4 } /* Literal.String.Single */ c-[u] { color: #6c71c4 } /* Literal.String.Double */ c-[ch] { color: #2aa198 } /* Comment.Hashbang */ c-[cp] { color: #2aa198 } /* Comment.Preproc */ c-[cpf] { color: #2aa198 } /* Comment.PreprocFile */ c-[c1] { color: #2aa198 } /* Comment.Single */ c-[cs] { color: #2aa198 } /* Comment.Special */ c-[kc] { color: #d33682 } /* Keyword.Constant */ c-[kn] { color: #d33682 } /* Keyword.Namespace */ c-[kp] { color: #d33682 } /* Keyword.Pseudo */ c-[kr] { color: #d33682 } /* Keyword.Reserved */ c-[ld] { color: #657b83 } /* Literal.Date */ c-[nc] { color: #268bd2 } /* Name.Class */ c-[no] { color: #268bd2 } /* Name.Constant */ c-[nd] { color: #268bd2 } /* Name.Decorator */ c-[ni] { color: #268bd2 } /* Name.Entity */ c-[ne] { color: #268bd2 } /* Name.Exception */ c-[nf] { color: #268bd2 } /* Name.Function */ c-[nl] { color: #268bd2 } /* Name.Label */ c-[nn] { color: #268bd2 } /* Name.Namespace */ c-[py] { color: #268bd2 } /* Name.Property */ c-[ow] { color: #657b83 } /* Operator.Word */ c-[mb] { color: #657b83 } /* Literal.Number.Bin */ c-[mf] { color: #657b83 } /* Literal.Number.Float */ c-[mh] { color: #657b83 } /* Literal.Number.Hex */ c-[mi] { color: #657b83 } /* Literal.Number.Integer */ c-[mo] { color: #657b83 } /* Literal.Number.Oct */ c-[sa] { color: #6c71c4 } /* Literal.String.Affix */ c-[sb] { color: #6c71c4 } /* Literal.String.Backtick */ c-[sc] { color: #6c71c4 } /* Literal.String.Char */ c-[dl] { color: #6c71c4 } /* Literal.String.Delimiter */ c-[sd] { color: #6c71c4 } /* Literal.String.Doc */ c-[se] { color: #6c71c4 } /* Literal.String.Escape */ c-[sh] { color: #6c71c4 } /* Literal.String.Heredoc */ c-[si] { color: #6c71c4 } /* Literal.String.Interpol */ c-[sx] { color: #6c71c4 } /* Literal.String.Other */ c-[sr] { color: #6c71c4 } /* Literal.String.Regex */ c-[ss] { color: #6c71c4 } /* Literal.String.Symbol */ c-[fm] { color: #268bd2 } /* Name.Function.Magic */ c-[vc] { color: #cb4b16 } /* Name.Variable.Class */ c-[vg] { color: #cb4b16 } /* Name.Variable.Global */ c-[vi] { color: #cb4b16 } /* Name.Variable.Instance */ c-[vm] { color: #cb4b16 } /* Name.Variable.Magic */ c-[il] { color: #657b83 } /* Literal.Number.Integer.Long */ } </style> <style>/* Boilerplate: style-var-click-highlighting */ /* Colors were chosen in Lab using https://nixsensor.com/free-color-converter/ D50 2deg illuminant, L in [0,100], a and b in [-128, 128] 0 = lab(85,0,85) 1 = lab(85,80,30) 2 = lab(85,-40,40) 3 = lab(85,-50,0) 4 = lab(85,5,15) 5 = lab(85,-10,-50) 6 = lab(85,35,-15) For darkmode: 0 = oklab(50% 0% 108%) 1 = oklab(50% -51% 51%) 2 = oklab(50% -64% -20%) 3 = oklab(50% 6% 19%) 4 = oklab(50% -12% -64%) 5 = oklab(50% 44% -19%) 6 = oklab(50% 102% 38%) */ [data-algorithm] var { cursor: pointer; } var[data-var-color] { background-color: var(--var-bg); box-shadow: 0 0 0 2px var(--var-bg); } var[data-var-color] { --var-bg: #F4D200; } var[data-var-color="1"] { --var-bg: #FF87A2; } var[data-var-color="2"] { --var-bg: #96E885; } var[data-var-color="3"] { --var-bg: #3EEED2; } var[data-var-color="4"] { --var-bg: #EACFB6; } var[data-var-color="5"] { --var-bg: #82DDFF; } var[data-var-color="6"] { --var-vg: #FFBCF2; } @media (prefers-color-scheme: dark) { var[data-var-color] { --var-bg: #bc1a00; } var[data-var-color="1"] { --var-bg: #007f00; } var[data-var-color="2"] { --var-bg: #008698; } var[data-var-color="3"] { --var-bg: #7f5b2b; } var[data-var-color="4"] { --var-bg: #004df3; } var[data-var-color="5"] { --var-bg: #a1248a; } var[data-var-color="6"] { --var-vg: #ff0000; } } </style> <style>/* Boilerplate: style-wpt */ :root { --wpt-border: hsl(0, 0%, 60%); --wpt-bg: hsl(0, 0%, 95%); --wpt-text: var(--text); --wptheading-text: hsl(0, 0%, 30%); } @media (prefers-color-scheme: dark) { :root { --wpt-border: hsl(0, 0%, 30%); --wpt-bg: var(--borderedblock-bg); --wpt-text: var(--text); --wptheading-text: hsl(0, 0%, 60%); } } .wpt-tests-block { list-style: none; border-left: .5em solid var(--wpt-border); background: var(--wpt-bg); color: var(--wpt-text); margin: 1em auto; padding: .5em; } .wpt-tests-block summary { color: var(--wptheading-text); font-weight: normal; text-transform: uppercase; } .wpt-tests-block summary::marker{ color: var(--wpt-border); } .wpt-tests-block summary:hover::marker{ color: var(--wpt-text); } /* The only content of a wpt test block in its closed state is the <summary>, which contains the word TESTS, and that is absolutely positioned. In that closed state, wpt test blocks are styled to have a top margin whose height is exactly equal to the height of the absolutely positioned <summary>, and no other background/padding/margin/border. The wpt test block elements will therefore allow the maring of the previous/next block elements to collapse through them; if this combined margin would be larger than its own top margin, it stays as is, and therefore the pre-existing vertical rhythm of the document is undisturbed. If that combined margin would be smaller, it is grown to that size. This means that the wpt test block ensures that there's always enough vertical space to insert the summary, without adding more than is needed. */ .wpt-tests-block:not([open]){ padding: 0; border: none; background: none; font-size: 0.75em; line-height: 1; position: relative; margin: 1em 0 0; } .wpt-tests-block:not([open]) summary { position: absolute; right: 0; bottom: 0; } /* It is possible that both the last child of a block element and the block element itself would be annotated with a <wpt> block each. If the block element has a padding or a border, that's fine, but otherwise the bottom margin of the block and of its last child would collapse and both <wpt> elements would overlap, being both placed there. To avoid that, add 1px of padding to the <wpt> element annotating the last child to prevent the bottom margin of the block and of its last child from collapsing (and as much negative margin, as wel only want to prevent margin collapsing, but are not trying to actually take more space). */ .wpt-tests-block:not([open]):last-child { padding-bottom: 1px; margin-bottom: -1px; } /* Exception to the previous rule: don't do that in non-last list items, because it's not necessary, and would therefore consume more space than strictly needed. Lists must have list items as children, not <wpt> elements, so a <wpt> element cannot be a sibling of a list item, and the collision that the previous rule avoids cannot happen. */ li:not(:last-child) > .wpt-tests-block:not([open]):last-child, dd:not(:last-child) > .wpt-tests-block:not([open]):last-child { padding-bottom: 0; margin-bottom: 0; } .wpt-tests-block:not([open]):not(:hover){ opacity: 0.5; } .wpt-tests-list { list-style: none; display: grid; margin: 0; padding: 0; grid-template-columns: 1fr max-content auto auto; grid-column-gap: .5em; } .wpt-tests-block hr:last-child { display: none; } .wpt-test { display: contents; } .wpt-test > a { text-decoration: underline; border: none; } .wpt-test > .wpt-name { grid-column: 1; } .wpt-test > .wpt-results { grid-column: 2; } .wpt-test > .wpt-live { grid-column: 3; } .wpt-test > .wpt-source { grid-column: 4; } .wpt-test > .wpt-results { display: flex; gap: .1em; } .wpt-test .wpt-result { display: inline-block; height: 1em; width: 1em; border-radius: 50%; position: relative; } </style> <body class="h-entry"> <div class="head"> <p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a> </p> <h1 class="p-name no-ref" id="title">Selectors Level 4</h1> <p id="w3c-state"><a href="https://www.w3.org/standards/types/#ED">Editor’s Draft</a>, <time class="dt-updated" datetime="2024-11-22">22 November 2024</time></p> <details open> <summary>More details about this document</summary> <div data-fill-with="spec-metadata"> <dl> <dt>This version: <dd><a class="u-url" href="https://drafts.csswg.org/selectors/">https://drafts.csswg.org/selectors/</a> <dt>Latest published version: <dd><a href="https://www.w3.org/TR/selectors-4/">https://www.w3.org/TR/selectors-4/</a> <dt>Previous Versions: <dd><a href="https://www.w3.org/TR/2022/WD-selectors-4-20220507/" rel="prev">https://www.w3.org/TR/2022/WD-selectors-4-20220507/</a> <dd><a href="https://www.w3.org/TR/2018/WD-selectors-4-20181121/" rel="prev">https://www.w3.org/TR/2018/WD-selectors-4-20181121/</a> <dd><a href="https://www.w3.org/TR/2018/WD-selectors-4-20180202/" rel="prev">https://www.w3.org/TR/2018/WD-selectors-4-20180202/</a> <dd><a href="https://www.w3.org/TR/2018/WD-selectors-4-20180201/" rel="prev">https://www.w3.org/TR/2018/WD-selectors-4-20180201/</a> <dd><a href="https://www.w3.org/TR/2013/WD-selectors4-20130502/" rel="prev">https://www.w3.org/TR/2013/WD-selectors4-20130502/</a> <dd><a href="https://www.w3.org/TR/2012/WD-selectors4-20120823/" rel="prev">https://www.w3.org/TR/2012/WD-selectors4-20120823/</a> <dd><a href="https://www.w3.org/TR/2011/WD-selectors4-20110929/" rel="prev">https://www.w3.org/TR/2011/WD-selectors4-20110929/</a> <dt>Feedback: <dd><a href="https://github.com/w3c/csswg-drafts/labels/selectors-4">CSSWG Issues Repository</a> <dd><a href="#issues-index">Inline In Spec</a> <dt class="editor">Editors: <dd class="editor p-author h-card vcard" data-editor-id="35400"><a class="p-name fn u-url url" href="http://fantasai.inkedblade.net/contact">Elika J. Etemad / fantasai</a> (<span class="p-org org">Apple</span>) <dd class="editor p-author h-card vcard" data-editor-id="42199"><a class="p-name fn u-url url" href="http://xanthir.com/contact/">Tab Atkins Jr.</a> (<span class="p-org org">Google</span>) <dt class="editor">Former Editors: <dd class="editor p-author h-card vcard"><a class="p-name fn u-url url" href="http://www.tantek.com">Tantek Çelik</a> <dd class="editor p-author h-card vcard"><span class="p-name fn">Daniel Glazman</span> <dd class="editor p-author h-card vcard"><span class="p-name fn">Ian Hickson</span> <dd class="editor p-author h-card vcard"><span class="p-name fn">Peter Linss</span> <dd class="editor p-author h-card vcard"><span class="p-name fn">John Williams</span> <dt>Suggest an Edit for this Spec: <dd><a href="https://github.com/w3c/csswg-drafts/blob/main/selectors-4/Overview.bs">GitHub Editor</a> </dl> </div> </details> <div data-fill-with="warning"></div> <p class="copyright" data-fill-with="copyright"><a href="https://www.w3.org/policies/#copyright">Copyright</a> © 2024 <a href="https://www.w3.org/">World Wide Web Consortium</a>. <abbr title="World Wide Web Consortium">W3C</abbr><sup>®</sup> <a href="https://www.w3.org/policies/#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/policies/#W3C_Trademarks">trademark</a> and <a href="https://www.w3.org/copyright/software-license/" rel="license" title="W3C Software and Document License">permissive document license</a> rules apply. </p> <hr title="Separator for header"> </div> <div class="p-summary" data-fill-with="abstract"> <h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2> <p><a data-link-type="dfn" href="#selector" id="ref-for-selector">Selectors</a> are patterns that match against elements in a tree, and as such form one of several technologies that can be used to select nodes in a document. Selectors have been optimized for use with HTML and XML, and are designed to be usable in performance-critical code. They are a core component of <abbr title="Cascading Style Sheets">CSS</abbr> (Cascading Style Sheets), which uses Selectors to bind style properties to elements in the document. Selectors Level 4 describes the selectors that already exist in <a data-link-type="biblio" href="#biblio-select" title="Selectors Level 3">[SELECT]</a>, and further introduces new selectors for CSS and other languages that may need them.</p> <a href="https://www.w3.org/TR/CSS/">CSS</a> is a language for describing the rendering of structured documents (such as HTML and XML) on screen, on paper, etc. <script> const githubPrefix = "https://w3c.github.io/csswg-drafts/"; if(location.href.slice(0, githubPrefix.length) == githubPrefix) { const suffix = location.href.slice(githubPrefix.length); const draftUrl = "https://drafts.csswg.org/" + suffix; window.location.replace(draftUrl); } </script> </div> <h2 class="no-num no-toc no-ref heading settled" id="sotd"><span class="content">Status of this document</span></h2> <div data-fill-with="status"> <p> This is a public copy of the editors’ draft. It is provided for discussion only and may change at any moment. Its publication here does not imply endorsement of its contents by W3C. Don’t cite this document other than as work in progress. </p> <p>Please send feedback by <a href="https://github.com/w3c/csswg-drafts/issues">filing issues in GitHub</a> (preferred), including the spec code “selectors” in the title, like this: “[selectors] <i>…summary of comment…</i>”. All issues and comments are <a href="https://lists.w3.org/Archives/Public/public-css-archive/">archived</a>. Alternately, feedback can be sent to the (<a href="https://lists.w3.org/Archives/Public/www-style/">archived</a>) public mailing list <a href="mailto:www-style@w3.org?Subject=%5Bselectors%5D%20PUT%20SUBJECT%20HERE">www-style@w3.org</a>. </p> <p>This document is governed by the <a href="https://www.w3.org/policies/process/20231103/" id="w3c_process_revision">03 November 2023 W3C Process Document</a>. </p> <p></p> </div> <div data-fill-with="at-risk"> <p>The following features are at-risk, and may be dropped during the CR period: </p> <ul> <li>the column combinator <li><a data-link-type="dfn" href="#user-action-pseudo-class" id="ref-for-user-action-pseudo-class">user action pseudo-classes</a> applying to non-<a data-link-type="dfn" href="https://www.w3.org/TR/css-pseudo-4/#tree-abiding" id="ref-for-tree-abiding">tree-abiding</a> <a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element">pseudo-elements</a> <li>the <a class="css" data-link-type="maybe" href="#blank-pseudo" id="ref-for-blank-pseudo">:blank</a> pseudo-class </ul> <p>“At-risk” is a W3C Process term-of-art, and does not necessarily imply that the feature is in danger of being dropped or delayed. It means that the WG believes the feature may have difficulty being interoperably implemented in a timely manner, and marking it as such allows the WG to drop the feature if necessary when transitioning to the Proposed Rec stage, without having to publish a new Candidate Rec without the feature first.</p> </div> <nav data-fill-with="table-of-contents" id="toc"> <h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2> <ol class="toc" role="directory"> <li> <a href="#context"><span class="secno">1</span> <span class="content"> Introduction</span></a> <ol class="toc"> <li><a href="#placement"><span class="secno">1.1</span> <span class="content">Module Interactions</span></a> </ol> <li><a href="#overview"><span class="secno">2</span> <span class="content"> Selectors Overview</span></a> <li> <a href="#syntax"><span class="secno">3</span> <span class="content"> Selector Syntax and Structure</span></a> <ol class="toc"> <li><a href="#structure"><span class="secno">3.1</span> <span class="content"> Structure and Terminology</span></a> <li> <a href="#data-model"><span class="secno">3.2</span> <span class="content"> Data Model</span></a> <ol class="toc"> <li><a href="#featureless-elements"><span class="secno">3.2.1</span> <span class="content"> Featureless Elements</span></a> </ol> <li><a href="#scoping"><span class="secno">3.3</span> <span class="content"> Scoped Selectors</span></a> <li><a href="#relative"><span class="secno">3.4</span> <span class="content"> Relative Selectors</span></a> <li><a href="#pseudo-classes"><span class="secno">3.5</span> <span class="content"> Pseudo-classes</span></a> <li> <a href="#pseudo-elements"><span class="secno">3.6</span> <span class="content">Pseudo-elements</span></a> <ol class="toc"> <li><a href="#pseudo-element-syntax"><span class="secno">3.6.1</span> <span class="content"> Syntax</span></a> <li><a href="#pseudo-element-attachment"><span class="secno">3.6.2</span> <span class="content"> Binding to the Document Tree</span></a> <li><a href="#pseudo-element-states"><span class="secno">3.6.3</span> <span class="content"> Pseudo-classing Pseudo-elements</span></a> <li><a href="#sub-pseudo-elements"><span class="secno">3.6.4</span> <span class="content"> Sub-pseudo-elements</span></a> <li><a href="#pseudo-element-structure"><span class="secno">3.6.5</span> <span class="content"> Internal Structure</span></a> </ol> <li><a href="#case-sensitive"><span class="secno">3.7</span> <span class="content"> Characters and case sensitivity</span></a> <li><a href="#namespaces"><span class="secno">3.8</span> <span class="content"> Declaring Namespace Prefixes</span></a> <li><a href="#invalid"><span class="secno">3.9</span> <span class="content"> Invalid Selectors and Error Handling</span></a> <li><a href="#legacy-aliasing"><span class="secno">3.10</span> <span class="content"> Legacy Aliases</span></a> </ol> <li> <a href="#logical-combination"><span class="secno">4</span> <span class="content"> Logical Combinations</span></a> <ol class="toc"> <li><a href="#grouping"><span class="secno">4.1</span> <span class="content"> Selector Lists</span></a> <li><a href="#matches"><span class="secno">4.2</span> <span class="content"> The Matches-Any Pseudo-class: <span class="css">:is()</span></span></a> <li><a href="#negation"><span class="secno">4.3</span> <span class="content"> The Negation (Matches-None) Pseudo-class: <span class="css">:not()</span></span></a> <li><a href="#zero-matches"><span class="secno">4.4</span> <span class="content"> The Specificity-adjustment Pseudo-class: <span class="css">:where()</span></span></a> <li><a href="#relational"><span class="secno">4.5</span> <span class="content"> The Relational Pseudo-class: <span class="css">:has()</span></span></a> </ol> <li> <a href="#elemental-selectors"><span class="secno">5</span> <span class="content"> Elemental selectors</span></a> <ol class="toc"> <li><a href="#type-selectors"><span class="secno">5.1</span> <span class="content"> Type (tag name) selector</span></a> <li><a href="#the-universal-selector"><span class="secno">5.2</span> <span class="content"> Universal selector </span></a> <li><a href="#type-nmsp"><span class="secno">5.3</span> <span class="content"> Namespaces in Elemental Selectors</span></a> <li><a href="#the-defined-pseudo"><span class="secno">5.4</span> <span class="content"> The Defined Pseudo-class: <span class="css">:defined</span></span></a> </ol> <li> <a href="#attribute-selectors"><span class="secno">6</span> <span class="content"> Attribute selectors</span></a> <ol class="toc"> <li><a href="#attribute-representation"><span class="secno">6.1</span> <span class="content"> Attribute presence and value selectors</span></a> <li><a href="#attribute-substrings"><span class="secno">6.2</span> <span class="content"> Substring matching attribute selectors</span></a> <li><a href="#attribute-case"><span class="secno">6.3</span> <span class="content"> Case-sensitivity</span></a> <li><a href="#attrnmsp"><span class="secno">6.4</span> <span class="content"> Attribute selectors and namespaces</span></a> <li><a href="#def-values"><span class="secno">6.5</span> <span class="content"> Default attribute values in DTDs</span></a> <li><a href="#class-html"><span class="secno">6.6</span> <span class="content"> Class selectors</span></a> <li><a href="#id-selectors"><span class="secno">6.7</span> <span class="content"> ID selectors</span></a> </ol> <li> <a href="#linguistic-pseudos"><span class="secno">7</span> <span class="content"> Linguistic Pseudo-classes</span></a> <ol class="toc"> <li><a href="#the-dir-pseudo"><span class="secno">7.1</span> <span class="content"> The Directionality Pseudo-class: <span class="css">:dir()</span></span></a> <li><a href="#the-lang-pseudo"><span class="secno">7.2</span> <span class="content"> The Language Pseudo-class: <span class="css">:lang()</span></span></a> </ol> <li> <a href="#location"><span class="secno">8</span> <span class="content"> Location Pseudo-classes</span></a> <ol class="toc"> <li><a href="#the-any-link-pseudo"><span class="secno">8.1</span> <span class="content"> The Hyperlink Pseudo-class: <span class="css">:any-link</span></span></a> <li><a href="#link"><span class="secno">8.2</span> <span class="content"> The Link History Pseudo-classes: <span class="css">:link</span> and <span class="css">:visited</span></span></a> <li><a href="#the-local-link-pseudo"><span class="secno">8.3</span> <span class="content"> The Local Link Pseudo-class: <span class="css">:local-link</span></span></a> <li><a href="#the-target-pseudo"><span class="secno">8.4</span> <span class="content"> The Target Pseudo-class: <span class="css">:target</span></span></a> <li><a href="#the-target-within-pseudo"><span class="secno">8.5</span> <span class="content"> The Target Container Pseudo-class: <span class="css">:target-within</span></span></a> <li><a href="#the-scope-pseudo"><span class="secno">8.6</span> <span class="content"> The Reference Element Pseudo-class: <span class="css">:scope</span></span></a> </ol> <li> <a href="#useraction-pseudos"><span class="secno">9</span> <span class="content"> User Action Pseudo-classes</span></a> <ol class="toc"> <li><a href="#the-hover-pseudo"><span class="secno">9.1</span> <span class="content"> The Pointer Hover Pseudo-class: <span class="css">:hover</span></span></a> <li><a href="#the-active-pseudo"><span class="secno">9.2</span> <span class="content"> The Activation Pseudo-class: <span class="css">:active</span></span></a> <li><a href="#the-focus-pseudo"><span class="secno">9.3</span> <span class="content"> The Input Focus Pseudo-class: <span class="css">:focus</span></span></a> <li><a href="#the-focus-visible-pseudo"><span class="secno">9.4</span> <span class="content"> The Focus-Indicated Pseudo-class: <span class="css">:focus-visible</span></span></a> <li><a href="#the-focus-within-pseudo"><span class="secno">9.5</span> <span class="content"> The Focus Container Pseudo-class: <span class="css">:focus-within</span></span></a> </ol> <li> <a href="#time-pseudos"><span class="secno">10</span> <span class="content"> Time-dimensional Pseudo-classes</span></a> <ol class="toc"> <li><a href="#the-current-pseudo"><span class="secno">10.1</span> <span class="content"> The Current-element Pseudo-class: <span class="css">:current</span></span></a> <li><a href="#the-past-pseudo"><span class="secno">10.2</span> <span class="content"> The Past-element Pseudo-class: <span class="css">:past</span></span></a> <li><a href="#the-future-pseudo"><span class="secno">10.3</span> <span class="content"> The Future-element Pseudo-class: <span class="css">:future</span></span></a> </ol> <li> <a href="#resource-pseudos"><span class="secno">11</span> <span class="content"> Resource State Pseudo-classes</span></a> <ol class="toc"> <li><a href="#video-state"><span class="secno">11.1</span> <span class="content"> Media Playback State: the <span class="css">:playing</span>, <span class="css">:paused</span>, and <span class="css">:seeking</span> pseudo-classes</span></a> <li><a href="#media-loading-state"><span class="secno">11.2</span> <span class="content"> Media Loading State: the <span class="css">:buffering</span> and <span class="css">:stalled</span> pseudo-classes</span></a> <li><a href="#sound-state"><span class="secno">11.3</span> <span class="content"> Sound State: the <span class="css">:muted</span> and <span class="css">:volume-locked</span> pseudo-classes</span></a> </ol> <li> <a href="#display-state-pseudos"><span class="secno">12</span> <span class="content"> Element Display State Pseudo-classes</span></a> <ol class="toc"> <li><a href="#open-state"><span class="secno">12.1</span> <span class="content"> Collapse State: the <span class="css">:open</span> and <span class="css">:closed</span> pseudo-class</span></a> <li><a href="#modal-state"><span class="secno">12.2</span> <span class="content"> Modal (Exclusive Interaction) State: the <span class="css">:modal</span> pseudo-class</span></a> <li><a href="#fullscreen-state"><span class="secno">12.3</span> <span class="content"> Fullscreen Presentation State: the <span class="css">:fullscreen</span> pseudo-class</span></a> <li><a href="#pip-state"><span class="secno">12.4</span> <span class="content"> Picture-in-Picture Presentation State: the <span class="css">:picture-in-picture</span> pseudo-class</span></a> </ol> <li> <a href="#input-pseudos"><span class="secno">13</span> <span class="content"> The Input Pseudo-classes</span></a> <ol class="toc"> <li> <a href="#input-states"><span class="secno">13.1</span> <span class="content"> Input Control States</span></a> <ol class="toc"> <li><a href="#enableddisabled"><span class="secno">13.1.1</span> <span class="content"> The <span class="css">:enabled</span> and <span class="css">:disabled</span> Pseudo-classes</span></a> <li><a href="#rw-pseudos"><span class="secno">13.1.2</span> <span class="content"> The Mutability Pseudo-classes: <span class="css">:read-only</span> and <span class="css">:read-write</span></span></a> <li><a href="#placeholder"><span class="secno">13.1.3</span> <span class="content"> The Placeholder-shown Pseudo-class: <span class="css">:placeholder-shown</span></span></a> <li><a href="#autofill"><span class="secno">13.1.4</span> <span class="content"> The Automatic Input Pseudo-class: <span class="css">:autofill</span></span></a> <li><a href="#the-default-pseudo"><span class="secno">13.1.5</span> <span class="content"> The Default-option Pseudo-class: <span class="css">:default</span></span></a> </ol> <li> <a href="#input-value-states"><span class="secno">13.2</span> <span class="content"> Input Value States</span></a> <ol class="toc"> <li><a href="#checked"><span class="secno">13.2.1</span> <span class="content"> The Selected-option Pseudo-class: <span class="css">:checked</span></span></a> <li><a href="#indeterminate"><span class="secno">13.2.2</span> <span class="content"> The Indeterminate-value Pseudo-class: <span class="css">:indeterminate</span></span></a> </ol> <li> <a href="#ui-validity"><span class="secno">13.3</span> <span class="content"> Input Value-checking</span></a> <ol class="toc"> <li><a href="#blank"><span class="secno">13.3.1</span> <span class="content"> The Empty-Value Pseudo-class: <span class="css">:blank</span></span></a> <li><a href="#validity-pseudos"><span class="secno">13.3.2</span> <span class="content"> The Validity Pseudo-classes: <span class="css">:valid</span> and <span class="css">:invalid</span></span></a> <li><a href="#range-pseudos"><span class="secno">13.3.3</span> <span class="content"> The Range Pseudo-classes: <span class="css">:in-range</span> and <span class="css">:out-of-range</span></span></a> <li><a href="#opt-pseudos"><span class="secno">13.3.4</span> <span class="content"> The Optionality Pseudo-classes: <span class="css">:required</span> and <span class="css">:optional</span></span></a> <li><a href="#user-pseudos"><span class="secno">13.3.5</span> <span class="content"> The User-interaction Pseudo-classes: <span class="css">:user-valid</span> and <span class="css">:user-invalid</span></span></a> </ol> </ol> <li> <a href="#structural-pseudos"><span class="secno">14</span> <span class="content"> Tree-Structural pseudo-classes</span></a> <ol class="toc"> <li><a href="#the-root-pseudo"><span class="secno">14.1</span> <span class="content"> <span class="css">:root</span> pseudo-class</span></a> <li><a href="#the-empty-pseudo"><span class="secno">14.2</span> <span class="content"> <span class="css">:empty</span> pseudo-class</span></a> <li> <a href="#child-index"><span class="secno">14.3</span> <span class="content"> Child-indexed Pseudo-classes</span></a> <ol class="toc"> <li><a href="#the-nth-child-pseudo"><span class="secno">14.3.1</span> <span class="content"> <span class="css">:nth-child()</span> pseudo-class</span></a> <li><a href="#the-nth-last-child-pseudo"><span class="secno">14.3.2</span> <span class="content"> <span class="css">:nth-last-child()</span> pseudo-class</span></a> <li><a href="#the-first-child-pseudo"><span class="secno">14.3.3</span> <span class="content"> <span class="css">:first-child</span> pseudo-class</span></a> <li><a href="#the-last-child-pseudo"><span class="secno">14.3.4</span> <span class="content"> <span class="css">:last-child</span> pseudo-class</span></a> <li><a href="#the-only-child-pseudo"><span class="secno">14.3.5</span> <span class="content"> <span class="css">:only-child</span> pseudo-class</span></a> </ol> <li> <a href="#typed-child-index"><span class="secno">14.4</span> <span class="content"> Typed Child-indexed Pseudo-classes</span></a> <ol class="toc"> <li><a href="#the-nth-of-type-pseudo"><span class="secno">14.4.1</span> <span class="content"> <span class="css">:nth-of-type()</span> pseudo-class</span></a> <li><a href="#the-nth-last-of-type-pseudo"><span class="secno">14.4.2</span> <span class="content"> <span class="css">:nth-last-of-type()</span> pseudo-class</span></a> <li><a href="#the-first-of-type-pseudo"><span class="secno">14.4.3</span> <span class="content"> <span class="css">:first-of-type</span> pseudo-class</span></a> <li><a href="#the-last-of-type-pseudo"><span class="secno">14.4.4</span> <span class="content"> <span class="css">:last-of-type</span> pseudo-class</span></a> <li><a href="#the-only-of-type-pseudo"><span class="secno">14.4.5</span> <span class="content"> <span class="css">:only-of-type</span> pseudo-class</span></a> </ol> </ol> <li> <a href="#combinators"><span class="secno">15</span> <span class="content"> Combinators</span></a> <ol class="toc"> <li><a href="#descendant-combinators"><span class="secno">15.1</span> <span class="content"> Descendant combinator (<code> </code>)</span></a> <li><a href="#child-combinators"><span class="secno">15.2</span> <span class="content"> Child combinator (<code>></code>)</span></a> <li><a href="#adjacent-sibling-combinators"><span class="secno">15.3</span> <span class="content"> Next-sibling combinator (<code>+</code>)</span></a> <li><a href="#general-sibling-combinators"><span class="secno">15.4</span> <span class="content"> Subsequent-sibling combinator (<code>~</code>)</span></a> </ol> <li> <a href="#table-pseudos"><span class="secno">16</span> <span class="content"> Grid-Structural Selectors</span></a> <ol class="toc"> <li><a href="#the-column-combinator"><span class="secno">16.1</span> <span class="content"> Column combinator (<code>||</code>)</span></a> <li><a href="#the-nth-col-pseudo"><span class="secno">16.2</span> <span class="content"> <span class="css">:nth-col()</span> pseudo-class</span></a> <li><a href="#the-nth-last-col-pseudo"><span class="secno">16.3</span> <span class="content"> <span class="css">:nth-last-col()</span> pseudo-class</span></a> </ol> <li><a href="#specificity-rules"><span class="secno">17</span> <span class="content"> Calculating a selector’s specificity</span></a> <li> <a href="#grammar"><span class="secno">18</span> <span class="content"> Grammar</span></a> <ol class="toc"> <li><a href="#forgiving-selector"><span class="secno">18.1</span> <span class="content"> <span class="production"><forgiving-selector-list></span> and <span class="production"><forgiving-relative-selector-list></span></span></a> </ol> <li> <a href="#api-hooks"><span class="secno">19</span> <span class="content"> API Hooks</span></a> <ol class="toc"> <li><a href="#parse-selector"><span class="secno">19.1</span> <span class="content"> Parse A Selector</span></a> <li><a href="#parse-relative-selector"><span class="secno">19.2</span> <span class="content"> Parse A Relative Selector</span></a> <li><a href="#match-against-element"><span class="secno">19.3</span> <span class="content"> Match a Selector Against an Element</span></a> <li><a href="#match-against-pseudo-element"><span class="secno">19.4</span> <span class="content"> Match a Selector Against a Pseudo-element</span></a> <li><a href="#match-against-tree"><span class="secno">19.5</span> <span class="content"> Match a Selector Against a Tree</span></a> </ol> <li><a href="#dom-mapping"><span class="secno"></span> <span class="content"> Appendix A: Guidance on Mapping Source Documents & Data to an Element Tree</span></a> <li><a href="#compat"><span class="secno"></span> <span class="content"> Appendix B: Obsolete but Required <code>-webkit-</code> Parsing Quirks for Web Compat</span></a> <li> <a href="#changes"><span class="secno">20</span> <span class="content"> Changes</span></a> <ol class="toc"> <li><a href="#changes-2022-05"><span class="secno">20.1</span> <span class="content"> Changes since the 7 May 2022 Working Draft</span></a> <li><a href="#changes-2018-11"><span class="secno">20.2</span> <span class="content"> Changes since the 21 November 2018 Working Draft</span></a> <li><a href="#changes-2018-02"><span class="secno">20.3</span> <span class="content"> Changes since the 2 February 2018 Working Draft</span></a> <li><a href="#changes-2013"><span class="secno">20.4</span> <span class="content"> Changes since the 2 May 2013 Working Draft</span></a> <li><a href="#changes-2012"><span class="secno">20.5</span> <span class="content"> Changes since the 23 August 2012 Working Draft</span></a> <li><a href="#changes-2011"><span class="secno">20.6</span> <span class="content"> Changes since the 29 September 2011 Working Draft</span></a> <li><a href="#changes-level-3"><span class="secno">20.7</span> <span class="content"> Changes Since Level 3</span></a> </ol> <li><a href="#acknowledgements"><span class="secno">21</span> <span class="content"> Acknowledgements</span></a> <li><a href="#privacy"><span class="secno"></span> <span class="content">Privacy Considerations</span></a> <li><a href="#security"><span class="secno"></span> <span class="content">Security Considerations</span></a> <li> <a href="#w3c-conformance"><span class="secno"></span> <span class="content"> Conformance</span></a> <ol class="toc"> <li><a href="#w3c-conventions"><span class="secno"></span> <span class="content"> Document conventions</span></a> <li><a href="#w3c-conformance-classes"><span class="secno"></span> <span class="content"> Conformance classes</span></a> <li> <a href="#w3c-partial"><span class="secno"></span> <span class="content"> Partial implementations</span></a> <ol class="toc"> <li><a href="#w3c-conform-future-proofing"><span class="secno"></span> <span class="content"> Implementations of Unstable and Proprietary Features</span></a> </ol> <li><a href="#w3c-testing"><span class="secno"></span> <span class="content"> Non-experimental implementations</span></a> </ol> <li> <a href="#index"><span class="secno"></span> <span class="content">Index</span></a> <ol class="toc"> <li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a> <li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a> </ol> <li> <a href="#references"><span class="secno"></span> <span class="content">References</span></a> <ol class="toc"> <li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a> <li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a> </ol> <li><a href="#issues-index"><span class="secno"></span> <span class="content">Issues Index</span></a> </ol> </nav> <main> <h2 class="heading settled" data-level="1" id="context"><span class="secno">1. </span><span class="content"> Introduction</span><a class="self-link" href="#context"></a></h2> <p><em>This section is not normative.</em></p> <p>A <a data-link-type="dfn" href="#selector" id="ref-for-selector①">selector</a> is a boolean predicate that takes an element in a tree structure and tests whether the element matches the selector or not.</p> <p>These expressions may be used for many things:</p> <ul> <li> directly on an element to test whether it matches some criteria, such as in the <code>element.matches()</code> function defined in <a data-link-type="biblio" href="#biblio-dom" title="DOM Standard">[DOM]</a> <li> applied to an entire tree of elements to filter it into a set of elements that match the criteria, such as in the <code>document.querySelectorAll()</code> function defined in <a data-link-type="biblio" href="#biblio-dom" title="DOM Standard">[DOM]</a> or the selector of a CSS style rule. <li> used "in reverse" to generate markup that would match a given selector, such as in <a href="http://haml.info/">HAML</a> or <a href="https://en.wikipedia.org/wiki/Emmet_(software)">Emmet</a>. </ul> <p>Selectors Levels 1, 2, and 3 are defined as the subsets of selector functionality defined in the <a href="https://www.w3.org/TR/REC-CSS1">CSS1</a>, <a href="https://www.w3.org/TR/CSS21/">CSS2.1</a>, and <a href="https://www.w3.org/TR/css3-selectors/">Selectors Level 3</a> specifications, respectively. This module defines Selectors Level 4.</p> <h3 class="heading settled" data-level="1.1" id="placement"><span class="secno">1.1. </span><span class="content">Module Interactions</span><a class="self-link" href="#placement"></a></h3> <p>This module replaces the definitions of and extends the set of selectors defined for CSS in <a data-link-type="biblio" href="#biblio-select" title="Selectors Level 3">[SELECT]</a> and <a data-link-type="biblio" href="#biblio-css21" title="Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification">[CSS21]</a>.</p> <p>Pseudo-element selectors, which define abstract elements in a rendering tree, are not part of this specification: their generic syntax is described here, but, due to their close integration with the rendering model and irrelevance to other uses such as DOM queries, they will be defined in other modules.</p> <h2 class="heading settled" data-level="2" id="overview"><span class="secno">2. </span><span class="content"> Selectors Overview</span><a class="self-link" href="#overview"></a></h2> <p><em>This section is non-normative, as it merely summarizes the following sections.</em></p> <p>A selector represents a structure. This structure can be used as a condition (e.g. in a CSS rule) that determines which elements a selector matches in the document tree, or as a flat description of the HTML or XML fragment corresponding to that structure.</p> <p>Selectors may range from simple element names to rich contextual representations.</p> <p>The following table summarizes the Selector syntax:</p> <table class="data" id="selector-examples"> <colgroup> <col class="pattern"> <col class="meaning"> <col class="section"> <col class="level"> <thead> <tr> <th>Pattern <th>Represents <th>Section <th>Level <tbody> <tr> <td><code>*</code> <td>any element <td><a href="#the-universal-selector">§ 5.2 Universal selector</a> <td>2 <tr> <td><code>E</code> <td>an element of type E <td><a href="#type-selectors">§ 5.1 Type (tag name) selector</a> <td>1 <tbody> <tr> <td><code>E:not(<var>s1</var>, <var>s2</var>, …)</code> <td>an E element that does not match either <a data-link-type="dfn" href="#compound" id="ref-for-compound">compound selector</a> <var>s1</var> or <span id="ref-for-compound①">compound selector</span> <var>s2</var> <td><a href="#negation">§ 4.3 The Negation (Matches-None) Pseudo-class: :not()</a> <td>3/4 <tr> <td><code>E:is(<var>s1</var>, <var>s2</var>, …)</code> <td>an E element that matches <a data-link-type="dfn" href="#compound" id="ref-for-compound②">compound selector</a> <var>s1</var> and/or <span id="ref-for-compound③">compound selector</span> <var>s2</var> <td><a href="#matches">§ 4.2 The Matches-Any Pseudo-class: :is()</a> <td>4 <tr> <td><code>E:where(<var>s1</var>, <var>s2</var>, …)</code> <td>an E element that matches <a data-link-type="dfn" href="#compound" id="ref-for-compound④">compound selector</a> <var>s1</var> and/or <span id="ref-for-compound⑤">compound selector</span> <var>s2</var> but contributes no specificity. <td><a href="#zero-matches">§ 4.4 The Specificity-adjustment Pseudo-class: :where()</a> <td>4 <tr> <td><code>E:has(<var>rs1</var>, <var>rs2</var>, …)</code> <td>an E element, if there exists an element that matches either of the <a data-link-type="dfn" href="#relative-selector" id="ref-for-relative-selector">relative selectors</a> <var>rs1</var> or <var>rs2</var>, when evaluated with E as the <a data-link-type="dfn" href="#relative-selector-anchor-elements" id="ref-for-relative-selector-anchor-elements">anchor elements</a> <td><a href="#relational">§ 4.5 The Relational Pseudo-class: :has()</a> <td>4 <tbody> <tr> <td><code>E.warning</code> <td>an E element belonging to the class <code>warning</code> (the document language specifies how class is determined). <td><a href="#class-html">§ 6.6 Class selectors</a> <td>1 <tr> <td><code>E#myid</code> <td>an E element with ID equal to <code>myid</code>. <td><a href="#id-selectors">§ 6.7 ID selectors</a> <td>1 <tr> <td><code>E[foo]</code> <td>an E element with a <code>foo</code> attribute <td><a href="#attribute-representation">§ 6.1 Attribute presence and value selectors</a> <td>2 <tr> <td><code>E[foo="bar"]</code> <td>an E element whose <code>foo</code> attribute value is exactly equal to <code>bar</code> <td><a href="#attribute-representation">§ 6.1 Attribute presence and value selectors</a> <td>2 <tr> <td><code>E[foo="bar" i]</code> <td>an E element whose <code>foo</code> attribute value is exactly equal to any (ASCII-range) case-permutation of <code>bar</code> <td><a href="#attribute-case">§ 6.3 Case-sensitivity</a> <td>4 <tr> <td><code>E[foo="bar" s]</code> <td>an E element whose <code>foo</code> attribute value is <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#string-is" id="ref-for-string-is">identical to</a> <code>bar</code> <td><a href="#attribute-case">§ 6.3 Case-sensitivity</a> <td>4 <tr> <td><code>E[foo~="bar"]</code> <td>an E element whose <code>foo</code> attribute value is a list of whitespace-separated values, one of which is exactly equal to <code>bar</code> <td><a href="#attribute-representation">§ 6.1 Attribute presence and value selectors</a> <td>2 <tr> <td><code>E[foo^="bar"]</code> <td>an E element whose <code>foo</code> attribute value begins exactly with the string <code>bar</code> <td><a href="#attribute-substrings">§ 6.2 Substring matching attribute selectors</a> <td>3 <tr> <td><code>E[foo$="bar"]</code> <td>an E element whose <code>foo</code> attribute value ends exactly with the string <code>bar</code> <td><a href="#attribute-substrings">§ 6.2 Substring matching attribute selectors</a> <td>3 <tr> <td><code>E[foo*="bar"]</code> <td>an E element whose <code>foo</code> attribute value contains the substring <code>bar</code> <td><a href="#attribute-substrings">§ 6.2 Substring matching attribute selectors</a> <td>3 <tr> <td><code>E[foo|="en"]</code> <td>an E element whose <code>foo</code> attribute value is a hyphen-separated list of values beginning with <code>en</code> <td><a href="#attribute-representation">§ 6.1 Attribute presence and value selectors</a> <td>2 <tbody> <tr> <td><code>E:dir(ltr)</code> <td>an element of type E with left-to-right directionality (the document language specifies how directionality is determined) <td><a href="#the-dir-pseudo">§ 7.1 The Directionality Pseudo-class: :dir()</a> <td>4 <tr> <td><code>E:lang(zh, "*-hant")</code> <td>an element of type E tagged as being either in Chinese (any dialect or writing system) or otherwise written with traditional Chinese characters <td><a href="#the-lang-pseudo">§ 7.2 The Language Pseudo-class: :lang()</a> <td>2/4 <tbody> <tr> <td><code>E:any-link</code> <td>an E element being the source anchor of a hyperlink <td><a href="#the-any-link-pseudo">§ 8.1 The Hyperlink Pseudo-class: :any-link</a> <td>4 <tr> <td><code>E:link</code> <td>an E element being the source anchor of a hyperlink of which the target is not yet visited <td><a href="#link">§ 8.2 The Link History Pseudo-classes: :link and :visited</a> <td>1 <tr> <td><code>E:visited</code> <td>an E element being the source anchor of a hyperlink of which the target is already visited <td><a href="#link">§ 8.2 The Link History Pseudo-classes: :link and :visited</a> <td>1 <tr> <td><code>E:local-link</code> <td>an E element being the source anchor of a hyperlink targeting the current URL <td><a href="#the-local-link-pseudo">§ 8.3 The Local Link Pseudo-class: :local-link</a> <td>4 <tr> <td><code>E:target</code> <td>an E element being the target of the current URL <td><a href="#the-target-pseudo">§ 8.4 The Target Pseudo-class: :target</a> <td>3 <tr> <td><code>E:target-within</code> <td>an E element that is the target of the current URL or contains an element that does. <td><a href="#the-target-within-pseudo">§ 8.5 The Target Container Pseudo-class: :target-within</a> <td>4 <tr> <td><code>E:scope</code> <td>an E element being a <a data-link-type="dfn" href="#scoping-root" id="ref-for-scoping-root">scoping root</a> <td><a href="#the-scope-pseudo">§ 8.6 The Reference Element Pseudo-class: :scope</a> <td>4 <tbody> <tr> <td><code>E:current</code> <td>an E element that is currently presented in a time-dimensional canvas <td><a href="#the-current-pseudo">§ 10.1 The Current-element Pseudo-class: :current</a> <td>4 <tr> <td><code>E:current(<var>s</var>)</code> <td>an E element that is the deepest <a class="css" data-link-type="maybe" href="#current-pseudo" id="ref-for-current-pseudo">:current</a> element that matches selector <var>s</var> <td><a href="#the-current-pseudo">§ 10.1 The Current-element Pseudo-class: :current</a> <td>4 <tr> <td><code>E:past</code> <td>an E element that is in the past in a time-dimensional canvas <td><a href="#the-past-pseudo">§ 10.2 The Past-element Pseudo-class: :past</a> <td>4 <tr> <td><code>E:future</code> <td>an E element that is in the future in a time-dimensional canvas <td><a href="#the-future-pseudo">§ 10.3 The Future-element Pseudo-class: :future</a> <td>4 <tbody> <tr> <td><code>E:active</code> <td>an E element that is in an activated state <td><a href="#the-active-pseudo">§ 9.2 The Activation Pseudo-class: :active</a> <td>1 <tr> <td><code>E:hover</code> <td>an E element that is under the cursor, or that has a descendant under the cursor <td><a href="#the-hover-pseudo">§ 9.1 The Pointer Hover Pseudo-class: :hover</a> <td>2 <tr> <td><code>E:focus</code> <td>an E element that has user input focus <td><a href="#the-focus-pseudo">§ 9.3 The Input Focus Pseudo-class: :focus</a> <td>2 <tr> <td><code>E:focus-within</code> <td>an E element that has user input focus or contains an element that has input focus. <td><a href="#the-focus-within-pseudo">§ 9.5 The Focus Container Pseudo-class: :focus-within</a> <td>4 <tr> <td><code>E:focus-visible</code> <td>an E element that has user input focus, and the UA has determined that a focus ring or other indicator should be drawn for that element <td><a href="#the-focus-visible-pseudo">§ 9.4 The Focus-Indicated Pseudo-class: :focus-visible</a> <td>4 <tbody> <tr> <td><code>E:enabled<br>E:disabled</code> <td>a user interface element E that is enabled or disabled, respectively <td><a href="#enableddisabled">§ 13.1.1 The :enabled and :disabled Pseudo-classes</a> <td>3 <tr> <td><code>E:read-write</code><br><code>E:read-only</code> <td>a user interface element E that is user alterable, or not <td><a href="#rw-pseudos">§ 13.1.2 The Mutability Pseudo-classes: :read-only and :read-write</a> <td>3-UI/4 <tr> <td><code>E:placeholder-shown</code> <td>an input control currently showing placeholder text <td><a href="#placeholder">§ 13.1.3 The Placeholder-shown Pseudo-class: :placeholder-shown</a> <td>3-UI/4 <tr> <td><code>E:default</code> <td>a user interface element E that is the default item in a group of related choices <td><a href="#the-default-pseudo">§ 13.1.5 The Default-option Pseudo-class: :default</a> <td>3-UI/4 <tr> <td><code>E:checked</code> <td>a user interface element E that is checked/selected (for instance a radio-button or checkbox) <td><a href="#checked">§ 13.2.1 The Selected-option Pseudo-class: :checked</a> <td>3 <tr> <td><code>E:indeterminate</code> <td>a user interface element E that is in an indeterminate state (neither checked nor unchecked) <td><a href="#indeterminate">§ 13.2.2 The Indeterminate-value Pseudo-class: :indeterminate</a> <td>4 <tr> <td><code>E:valid</code><br><code>E:invalid</code> <td>a user-input element E that meets, or doesn’t, its data validity semantics <td><a href="#validity-pseudos">§ 13.3.2 The Validity Pseudo-classes: :valid and :invalid</a> <td>3-UI/4 <tr> <td><code>E:in-range</code><br><code>E:out-of-range</code> <td>a user-input element E whose value is in-range/out-of-range <td><a href="#range-pseudos">§ 13.3.3 The Range Pseudo-classes: :in-range and :out-of-range</a> <td>3-UI/4 <tr> <td><code>E:required</code><br><code>E:optional</code> <td>a user-input element E that requires/does not require input <td><a href="#opt-pseudos">§ 13.3.4 The Optionality Pseudo-classes: :required and :optional</a> <td>3-UI/4 <tr> <td><code>E:blank</code> <td>a user-input element E whose value is blank (empty/missing) <td><a href="#blank">§ 13.3.1 The Empty-Value Pseudo-class: :blank</a> <td>4 <tr> <td><code>E:user-invalid</code> <td>a user-altered user-input element E with incorrect input (invalid, out-of-range, omitted-but-required) <td><a href="#user-pseudos">§ 13.3.5 The User-interaction Pseudo-classes: :user-valid and :user-invalid</a> <td>4 <tbody> <tr> <td><code>E:root</code> <td>an E element, root of the document <td><a href="#the-root-pseudo">§ 14.1 :root pseudo-class</a> <td>3 <tr> <td><code>E:empty</code> <td>an E element that has no children (neither elements nor text) except perhaps white space <td><a href="#the-empty-pseudo">§ 14.2 :empty pseudo-class</a> <td>3 <tr> <td><code>E:nth-child(<var>n</var> [of <var>S</var>]?)</code> <td>an E element, the <var>n</var>-th child of its parent matching <var>S</var> <td><a href="#the-nth-child-pseudo">§ 14.3.1 :nth-child() pseudo-class</a> <td>3/4 <tr> <td><code>E:nth-last-child(<var>n</var> [of <var>S</var>]?)</code> <td>an E element, the <var>n</var>-th child of its parent matching <var>S</var>, counting from the last one <td><a href="#the-nth-last-child-pseudo">§ 14.3.2 :nth-last-child() pseudo-class</a> <td>3/4 <tr> <td><code>E:first-child</code> <td>an E element, first child of its parent <td><a href="#the-first-child-pseudo">§ 14.3.3 :first-child pseudo-class</a> <td>2 <tr> <td><code>E:last-child</code> <td>an E element, last child of its parent <td><a href="#the-last-child-pseudo">§ 14.3.4 :last-child pseudo-class</a> <td>3 <tr> <td><code>E:only-child</code> <td>an E element, only child of its parent <td><a href="#the-only-child-pseudo">§ 14.3.5 :only-child pseudo-class</a> <td>3 <tr> <td><code>E:nth-of-type(<var>n</var>)</code> <td>an E element, the <var>n</var>-th sibling of its type <td><a href="#the-nth-of-type-pseudo">§ 14.4.1 :nth-of-type() pseudo-class</a> <td>3 <tr> <td><code>E:nth-last-of-type(<var>n</var>)</code> <td>an E element, the <var>n</var>-th sibling of its type, counting from the last one <td><a href="#the-nth-last-of-type-pseudo">§ 14.4.2 :nth-last-of-type() pseudo-class</a> <td>3 <tr> <td><code>E:first-of-type</code> <td>an E element, first sibling of its type <td><a href="#the-first-of-type-pseudo">§ 14.4.3 :first-of-type pseudo-class</a> <td>3 <tr> <td><code>E:last-of-type</code> <td>an E element, last sibling of its type <td><a href="#the-last-of-type-pseudo">§ 14.4.4 :last-of-type pseudo-class</a> <td>3 <tr> <td><code>E:only-of-type</code> <td>an E element, only sibling of its type <td><a href="#the-only-of-type-pseudo">§ 14.4.5 :only-of-type pseudo-class</a> <td>3 <tbody> <tr> <td><code>E F</code> <td>an F element descendant of an E element <td><a href="#descendant-combinators">§ 15.1 Descendant combinator ( )</a> <td>1 <tr> <td><code>E > F</code> <td>an F element child of an E element <td><a href="#child-combinators">§ 15.2 Child combinator (>)</a> <td>2 <tr> <td><code>E + F</code> <td>an F element immediately preceded by an E element <td><a href="#adjacent-sibling-combinators">§ 15.3 Next-sibling combinator (+)</a> <td>2 <tr> <td><code>E ~ F</code> <td>an F element preceded by an E element <td><a href="#general-sibling-combinators">§ 15.4 Subsequent-sibling combinator (~)</a> <td>3 <tbody> <tr> <td><code>F || E</code> <td>an E element that represents a cell in a grid/table belonging to a column represented by an element F <td><a href="#the-column-combinator">§ 16.1 Column combinator (||)</a> <td>4 <tr> <td><code>E:nth-col(<var>n</var>)</code> <td>an E element that represents a cell belonging to the <var>n</var>th column in a grid/table <td><a href="#the-nth-col-pseudo">§ 16.2 :nth-col() pseudo-class</a> <td>4 <tr> <td><code>E:nth-last-col(<var>n</var>)</code> <td>an E element that represents a cell belonging to the <var>n</var>th column in a grid/table, counting from the last one <td><a href="#the-nth-last-col-pseudo">§ 16.3 :nth-last-col() pseudo-class</a> <td>4 </table> <p class="note" role="note"><span class="marker">Note:</span> Some Level 4 selectors (noted above as "3-UI") were introduced in <a data-link-type="biblio" href="#biblio-css3ui" title="CSS Basic User Interface Module Level 3 (CSS3 UI)">[CSS3UI]</a>.</p> <h2 class="heading settled" data-level="3" id="syntax"><span class="secno">3. </span><span class="content"> Selector Syntax and Structure</span><a class="self-link" href="#syntax"></a></h2> <h3 class="heading settled" data-level="3.1" id="structure"><span class="secno">3.1. </span><span class="content"> Structure and Terminology</span><a class="self-link" href="#structure"></a></h3> <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="selector">selector</dfn> represents a particular pattern of element(s) in a tree structure. The term <a data-link-type="dfn" href="#selector" id="ref-for-selector②">selector</a> can refer to a <a data-link-type="dfn" href="#simple" id="ref-for-simple">simple selector</a>, <a data-link-type="dfn" href="#compound" id="ref-for-compound⑥">compound selector</a>, <a data-link-type="dfn" href="#complex" id="ref-for-complex">complex selector</a>, or <a data-link-type="dfn" href="#selector-list" id="ref-for-selector-list">selector list</a>. The <dfn class="dfn-paneled" data-dfn-for="selector" data-dfn-type="dfn" data-export data-lt="subject|subject of a selector|subject of the selector" id="selector-subject">subject of a selector</dfn> is any element that selector is defined to be about; that is, any element <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="match" id="match">matching</dfn> that <span id="ref-for-selector③">selector</span>.</p> <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="simple">simple selector</dfn> is a single condition on an element. A <a data-link-type="dfn" href="#type-selector" id="ref-for-type-selector">type selector</a>, <a data-link-type="dfn" href="#universal-selector" id="ref-for-universal-selector">universal selector</a>, <a data-link-type="dfn" href="#attribute-selector" id="ref-for-attribute-selector">attribute selector</a>, <a data-link-type="dfn" href="#class-selector" id="ref-for-class-selector">class selector</a>, <a data-link-type="dfn" href="#id-selector" id="ref-for-id-selector">ID selector</a>, or <a data-link-type="dfn" href="#pseudo-class" id="ref-for-pseudo-class">pseudo-class</a> is a <a data-link-type="dfn" href="#simple" id="ref-for-simple①">simple selector</a>. (It is represented by <a class="production css" data-link-type="type" href="#typedef-simple-selector" id="ref-for-typedef-simple-selector"><simple-selector></a> in the selectors <a href="#grammar">grammar</a>.) A given element is said to <a data-link-type="dfn" href="#match" id="ref-for-match">match</a> a <span id="ref-for-simple②">simple selector</span> when that <span id="ref-for-simple③">simple selector</span>, as defined in this specification and in accordance with the <a data-link-type="dfn" href="#document-language" id="ref-for-document-language">document language</a>, accurately describes the element.</p> <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="compound">compound selector</dfn> is a sequence of <a data-link-type="dfn" href="#simple" id="ref-for-simple④">simple selectors</a> that are not separated by a <a data-link-type="dfn" href="#selector-combinator" id="ref-for-selector-combinator">combinator</a>, and represents a set of simultaneous conditions on a single element. If it contains a <a data-link-type="dfn" href="#type-selector" id="ref-for-type-selector①">type selector</a> or <a data-link-type="dfn" href="#universal-selector" id="ref-for-universal-selector①">universal selector</a>, that selector must come first in the sequence. Only one type selector or universal selector is allowed in the sequence. (A <a data-link-type="dfn" href="#compound" id="ref-for-compound⑦">compound selector</a> is represented by <a class="production css" data-link-type="type" href="#typedef-compound-selector" id="ref-for-typedef-compound-selector"><compound-selector></a> in the selectors <a href="#grammar">grammar</a>.) A given element is said to <a data-link-type="dfn" href="#match" id="ref-for-match①">match</a> a <span id="ref-for-compound⑧">compound selector</span> when it matches all <span id="ref-for-simple⑤">simple selectors</span> in the <span id="ref-for-compound⑨">compound selector</span>.</p> <p class="note" role="note"><span class="marker">Note:</span> As whitespace represents the <a data-link-type="dfn" href="#descendant-combinator" id="ref-for-descendant-combinator">descendant combinator</a>, no whitespace is allowed between the <a data-link-type="dfn" href="#simple" id="ref-for-simple⑥">simple selectors</a> in a <a data-link-type="dfn" href="#compound" id="ref-for-compound①⓪">compound selector</a>.</p> <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="pseudo-compound">pseudo-compound selector</dfn> is a <a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element①">pseudo-element</a> selector, optionally followed by additional <a data-link-type="dfn" href="#pseudo-class" id="ref-for-pseudo-class①">pseudo-class</a> selectors, and optionally preceded by a <a data-link-type="dfn" href="#compound" id="ref-for-compound①①">compound selector</a> or another <a data-link-type="dfn" href="#pseudo-compound" id="ref-for-pseudo-compound">pseudo-compound selector</a>, without any <a data-link-type="dfn" href="#selector-combinator" id="ref-for-selector-combinator①">combinators</a>. (A <span id="ref-for-pseudo-compound①">pseudo-compound selector</span> is represented by <a class="production css" data-link-type="type" href="#typedef-pseudo-compound-selector" id="ref-for-typedef-pseudo-compound-selector"><pseudo-compound-selector></a> in the selectors <a href="#grammar">grammar</a>.) A <span id="ref-for-pseudo-element②">pseudo-element</span> <a data-link-type="dfn" href="#match" id="ref-for-match②">matches</a> a <span id="ref-for-pseudo-compound②">pseudo-compound selector</span> when it has the specified pseudo-element name, matches the additional conditions represented by any <span id="ref-for-pseudo-class②">pseudo-classes</span>, and has an <a data-link-type="dfn" href="#originating-element" id="ref-for-originating-element">originating element</a> represented by the adjacent preceding selector. If there is no adjacent preceding selector, the <a data-link-type="dfn" href="#universal-selector" id="ref-for-universal-selector②">universal selector</a> is assumed. (For example, <span class="css">.foo ::before</span> is equivalent to <span class="css">.foo *::before</span>, and distinct from <span class="css">.foo::before</span>.)</p> <div class="example" id="example-9e91e72f"><a class="self-link" href="#example-9e91e72f"></a> For example, in <span class="css">.foo::before:hover</span>, the <span class="css">.foo</span> is a <a data-link-type="dfn" href="#compound" id="ref-for-compound①②">compound selector</a>, while the <span class="css">::before:hover</span> is a <a data-link-type="dfn" href="#pseudo-compound" id="ref-for-pseudo-compound③">pseudo-compound selector</a>. However, in <span class="css">.foo::before::marker</span>, <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-before" id="ref-for-selectordef-before">::before</a> and <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-marker" id="ref-for-selectordef-marker">::marker</a> are separate <span id="ref-for-pseudo-compound④">pseudo-compound selectors</span>. </div> <p class="note" role="note"><span class="marker">Note:</span> A <a data-link-type="dfn" href="#pseudo-compound" id="ref-for-pseudo-compound⑤">pseudo-compound selector</a> <strong>is not</strong> a <a data-link-type="dfn" href="#compound" id="ref-for-compound①③">compound selector</a>, and can’t be used in places that expect a <span id="ref-for-compound①④">compound selector</span> only. <span id="ref-for-pseudo-compound⑥">Pseudo-compound selectors</span> act as if they carry a <a data-link-type="dfn" href="#selector-combinator" id="ref-for-selector-combinator②">combinator</a> with themselves, expressing their relationship with their <a data-link-type="dfn" href="#originating-element" id="ref-for-originating-element①">originating element</a>, just as the <a class="css" data-link-type="maybe" href="#selectordef-child" id="ref-for-selectordef-child">></a> combinator expresses a relationship with a parent element.</p> <p>A <dfn class="dfn-paneled" data-dfn-for="selector" data-dfn-type="dfn" data-export id="selector-combinator">combinator</dfn> is a condition of relationship between two elements represented by the <a data-link-type="dfn" href="#compound" id="ref-for-compound①⑤">compound selectors</a> on either side. Combinators in Selectors Level 4 include: the <a data-link-type="dfn" href="#descendant-combinator" id="ref-for-descendant-combinator①">descendant combinator</a> (white space), the <a data-link-type="dfn" href="#child-combinator" id="ref-for-child-combinator">child combinator</a> (U+003E, <code>></code>), the <a data-link-type="dfn" href="#next-sibling-combinator" id="ref-for-next-sibling-combinator">next-sibling combinator</a> (U+002B, <code>+</code>), and the <a data-link-type="dfn" href="#subsequent-sibling-combinator" id="ref-for-subsequent-sibling-combinator">subsequent-sibling combinator</a> (U+007E, <code>~</code>). Two given elements are said to <a data-link-type="dfn" href="#match" id="ref-for-match③">match</a> a <a data-link-type="dfn" href="#selector-combinator" id="ref-for-selector-combinator③">combinator</a> when the condition of relationship between these elements is true.</p> <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="complex">complex selector</dfn> is a sequence of one or more <a data-link-type="dfn" href="#compound" id="ref-for-compound①⑥">compound selectors</a> and/or <a data-link-type="dfn" href="#pseudo-compound" id="ref-for-pseudo-compound⑦">pseudo-compound selectors</a>, with <span id="ref-for-compound①⑦">compound selectors</span> separated by <a data-link-type="dfn" href="#selector-combinator" id="ref-for-selector-combinator④">combinators</a>. It represents a set of simultaneous conditions on a set of elements in the particular relationships described by its <span id="ref-for-selector-combinator⑤">combinators</span>. (Complex selectors are represented by <a class="production css" data-link-type="type" href="#typedef-complex-selector" id="ref-for-typedef-complex-selector"><complex-selector></a> in the selectors <a href="#grammar">grammar</a>.) A given element or pseudo-element is said to <a data-link-type="dfn" href="#match" id="ref-for-match④">match</a> a <a data-link-type="dfn" href="#complex" id="ref-for-complex①">complex selector</a> when it matches the final <span id="ref-for-compound①⑧">compound</span>/<span id="ref-for-pseudo-compound⑧">pseudo-compound selector</span> in the sequence, and every preceding unit of the sequence also <span id="ref-for-match⑤">matches</span> an element or <a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element③">pseudo-element</a>, with the correct relationship between consecutive units as expressed by the combinators separating them (or, for <span id="ref-for-pseudo-compound⑨">pseudo-compound selectors</span>, the correct <a data-link-type="dfn" href="#originating-element" id="ref-for-originating-element②">originating element</a> relationship).</p> <div class="example" id="example-3e6d4159"> <a class="self-link" href="#example-3e6d4159"></a> For example, <span class="css">.foo.bar</span> matches an element with both "foo" and "bar" classes. <p><span class="css">.ancestor > .foo.bar</span> matches a subset of those elements: only those whose parent element (as indicated by the <a class="css" data-link-type="maybe" href="#selectordef-child" id="ref-for-selectordef-child①">></a> combinator) has the "ancestor" class.</p> <p><span class="css">.foo.bar::before</span> matches a <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-before" id="ref-for-selectordef-before①">::before</a> pseudo-element, whose <a data-link-type="dfn" href="#originating-element" id="ref-for-originating-element③">originating element</a> matches <span class="css">.foo.bar</span>.</p> </div> <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="list of simple selectors|list of compound selectors|list of complex selectors" id="list-of-simple-selectors">list of simple/compound/complex selectors</dfn> is a comma-separated list of <a data-link-type="dfn" href="#simple" id="ref-for-simple⑦">simple</a>, <a data-link-type="dfn" href="#compound" id="ref-for-compound①⑨">compound</a>, or <a data-link-type="dfn" href="#complex" id="ref-for-complex②">complex selectors</a>. This is also called just a <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="selector list|list of selectors" id="selector-list">selector list</dfn> when the type is either unimportant or specified in the surrounding prose; if the type is important and unspecified, it defaults to meaning a <a data-link-type="dfn" href="#list-of-simple-selectors" id="ref-for-list-of-simple-selectors">list of complex selectors</a>. (See <a href="#grouping">§ 4.1 Selector Lists</a> for additional information on <a data-link-type="dfn" href="#selector-list" id="ref-for-selector-list①">selector lists</a> and the various <*-selector-list> productions in the <a href="#grammar">grammar</a> for their formal syntax.) A given element is said to <a data-link-type="dfn" href="#match" id="ref-for-match⑥">match</a> a <span id="ref-for-selector-list②">selector list</span> when it matches any (at least one) of the <a data-link-type="dfn" href="#selector" id="ref-for-selector④">selectors</a> in that <span id="ref-for-selector-list③">selector list</span>.</p> <h3 class="heading settled" data-level="3.2" id="data-model"><span class="secno">3.2. </span><span class="content"> Data Model</span><a class="self-link" href="#data-model"></a></h3> <p>Selectors are evaluated against an element tree such as the DOM. <a data-link-type="biblio" href="#biblio-dom" title="DOM Standard">[DOM]</a> Within this specification, this may be referred to as the "document tree" or "source document".</p> <p>Each element may have any of the following five aspects, which can be selected against, all of which are matched as strings:</p> <ul> <li>The element’s type (also known as its tag name). <li>The element’s namespace. <li>An ID. <li>Classes (named groups) to which it belongs. <li>Attributes, which are name-value pairs. </ul> <p>Many of the selectors depend on the semantics of the <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="document-language">document language</dfn> (i.e. the language and semantics of the document tree) and/or the semantics of the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="host-language">host language</dfn> (i.e. the language that is using selectors syntax). For example, the <a class="css" data-link-type="maybe" href="#lang-pseudo" id="ref-for-lang-pseudo">:lang()</a> selector depends on the <a data-link-type="dfn" href="#document-language" id="ref-for-document-language①">document language</a> (e.g. HTML) to define how an element is associated with a language. As a slightly different example, the <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-first-line" id="ref-for-selectordef-first-line">::first-line</a> pseudo-element depends on the <a data-link-type="dfn" href="#host-language" id="ref-for-host-language">host language</a> (e.g. CSS) to define what a <span class="css" id="ref-for-selectordef-first-line①">::first-line</span> pseudo-element represents and what it can do.</p> <h4 class="heading settled" data-level="3.2.1" id="featureless-elements"><span class="secno">3.2.1. </span><span class="content"> Featureless Elements</span><a class="self-link" href="#featureless-elements"></a></h4> <p>While individual elements may lack any of the above features, some elements are <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="featureless">featureless</dfn>. A <a data-link-type="dfn" href="#featureless" id="ref-for-featureless">featureless</a> element does not match <em>any selector at all</em>, except:</p> <ul> <li data-md> <p><a data-link-type="dfn" href="#simple" id="ref-for-simple⑧">simple selectors</a> it is explicitly defined to match</p> <li data-md> <p><a data-link-type="dfn" href="#compound" id="ref-for-compound②⓪">compound selectors</a>, if all contained <a data-link-type="dfn" href="#simple" id="ref-for-simple⑨">simple selectors</a> are allowed to match it</p> <li data-md> <p><a data-link-type="dfn" href="#complex" id="ref-for-complex③">complex selectors</a>, if the <a data-link-type="dfn" href="#compound" id="ref-for-compound②①">compound selector</a> targeting the <a data-link-type="dfn" href="#selector-subject" id="ref-for-selector-subject">subject</a> is allowed to match it</p> <li data-md> <p><a data-link-type="dfn" href="#selector-list" id="ref-for-selector-list④">selector lists</a>, if at least one selector in the list is allowed to match it</p> <li data-md> <p><a data-link-type="dfn" href="#logical-combination-pseudo-classes" id="ref-for-logical-combination-pseudo-classes">logical combination pseudo-classes</a>, if their argument selector is allowed to match it</p> <li data-md> <p>the <a class="css" data-link-type="maybe" href="#has-pseudo" id="ref-for-has-pseudo">:has()</a> pseudo-class, if and only if the <a data-link-type="dfn" href="#compound" id="ref-for-compound②②">compound selector</a> it’s part of contains at least one <em>other</em> <a data-link-type="dfn" href="#simple" id="ref-for-simple①⓪">simple selector</a> that’s allowed to match it.</p> </ul> <p>If a selector would otherwise match a <a data-link-type="dfn" href="#featureless" id="ref-for-featureless①">featureless</a> element, except for the existence of the default namespace <a data-link-type="biblio" href="#biblio-css-namespaces-3" title="CSS Namespaces Module Level 3">[CSS-NAMESPACES-3]</a> (because <span id="ref-for-featureless②">featureless</span> elements do not have a namespace unless otherwise defined), the default namespace does not prevent the match.</p> <div class="example" id="example-351d0bfb"> <a class="self-link" href="#example-351d0bfb"></a> For example, the <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#element-shadow-host" id="ref-for-element-shadow-host">shadow host</a> in a <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-shadow-tree" id="ref-for-concept-shadow-tree">shadow tree</a> is <a data-link-type="dfn" href="#featureless" id="ref-for-featureless③">featureless</a>, and can’t be matched by <em>any</em> <a data-link-type="dfn" href="#pseudo-class" id="ref-for-pseudo-class③">pseudo-class</a> except for <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-scoping-1/#selectordef-host" id="ref-for-selectordef-host">:host</a> and <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-scoping-1/#selectordef-host-context" id="ref-for-selectordef-host-context">:host-context()</a> (or combinations including those, such as <span class="css">:is(:host, :root)</span>). <p>Logical combinations like <span class="css">:not(.foo:host)</span> will never match the host element (even if it doesn’t have a "foo" class), because not all of the simple selectors in <span class="css">.foo:host</span> are allowed to match the <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#element-shadow-host" id="ref-for-element-shadow-host①">shadow host</a>.</p> <p>Similarly, <span class="css">:not(:host > .foo)</span> will never match the <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#element-shadow-host" id="ref-for-element-shadow-host②">shadow host</a>, even tho the <span id="ref-for-element-shadow-host③">shadow host</span> is indeed *not* a descendant of itself and doesn’t have the "foo" class, because the subject of the complex selector argument (<span class="css">.foo</span>) isn’t allowed to match the <span id="ref-for-element-shadow-host④">shadow host</span>.</p> </div> <div class="example" id="example-a6be590b"> <a class="self-link" href="#example-a6be590b"></a> In general, you can’t match a <a data-link-type="dfn" href="#featureless" id="ref-for-featureless④">featureless</a> element without explicitly using one of the <a data-link-type="dfn" href="#simple" id="ref-for-simple①①">simple selectors</a> it’s allowed to match, to avoid accidentally selecting one of these elements (which are otherwise <em>intentionally</em> easy to not think about). For example, <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/selectors-3/#x" id="ref-for-x">*</a> will never match a <span id="ref-for-featureless⑤">featureless</span> element. <p>The rule for <a class="css" data-link-type="maybe" href="#has-pseudo" id="ref-for-has-pseudo①">:has()</a>, above, works similarly. Even if a <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#element-shadow-host" id="ref-for-element-shadow-host⑤">shadow host</a> contains a <span class="css">.foo</span> descendant, <span class="css">:has(.foo)</span> will not match it, because <em>the rest</em> of the compound selector (empty) doesn’t contain a simple selector that can match the host. You have to write <span class="css">:host:has(.foo)</span> in order to match the host element.</p> </div> <h3 class="heading settled" data-level="3.3" id="scoping"><span class="secno">3.3. </span><span class="content"> Scoped Selectors</span><a class="self-link" href="#scoping"></a></h3> <p>Some host applications may choose to <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-local-lt="scope" data-lt="scoped selector" id="scoped-selector">scope</dfn> selectors to a particular subtree or fragment of the document, The root of the scoping subtree is called the <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="scoping-root">scoping root</dfn>.</p> <p>When a selector is <a data-link-type="dfn" href="#scoped-selector" id="ref-for-scoped-selector">scoped</a>, it matches an element only if the element is a descendant of the <a data-link-type="dfn" href="#scoping-root" id="ref-for-scoping-root①">scoping root</a>. (The rest of the selector can match unrestricted; it’s only the final matched elements that must be within the scope.)</p> <div class="example" id="example-32ec254f"> <a class="self-link" href="#example-32ec254f"></a> For example, the <code class="idl"><a data-link-type="idl">querySelector()</a></code> method defined in <a data-link-type="biblio" href="#biblio-dom" title="DOM Standard">[DOM]</a> allows the author to evaluate a <a data-link-type="dfn" href="#scoped-selector" id="ref-for-scoped-selector①">scoped</a> selector relative to the element it’s called on. <p>A call like <code class="highlight">widget<c- p>.</c->querySelector<c- p>(</c-><c- u>"a"</c-><c- p>)</c-></code> will thus only find <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element" id="ref-for-the-a-element">a</a></code> elements inside of the <code>widget</code> element, ignoring any other <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element" id="ref-for-the-a-element①">a</a></code>s that might be scattered throughout the document.</p> </div> <h3 class="heading settled" data-level="3.4" id="relative"><span class="secno">3.4. </span><span class="content"> Relative Selectors</span><a class="self-link" href="#relative"></a></h3> <p>Certain contexts may accept <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-local-lt="relative" data-lt="relative selector" id="relative-selector">relative selectors</dfn>, which are a shorthand for selectors that represent elements relative to one or more <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-local-lt="anchor element" id="relative-selector-anchor-elements">relative selector anchor elements</dfn>. Relative selectors begin with a <a data-link-type="dfn" href="#selector-combinator" id="ref-for-selector-combinator⑥">combinator</a>, with a selector representing the <a data-link-type="dfn" href="#relative-selector-anchor-elements" id="ref-for-relative-selector-anchor-elements①">anchor element</a> implied at the start of the selector. (If no combinator is present, the <a data-link-type="dfn" href="#descendant-combinator" id="ref-for-descendant-combinator②">descendant combinator</a> is implied.)</p> <p>Relative selectors are represented by <a class="production css" data-link-type="type" href="#typedef-relative-selector" id="ref-for-typedef-relative-selector"><relative-selector></a> in the selectors <a href="#grammar">grammar</a>, and lists of them by <a class="production css" data-link-type="type" href="#typedef-relative-selector-list" id="ref-for-typedef-relative-selector-list"><relative-selector-list></a>.</p> <h3 class="heading settled" data-level="3.5" id="pseudo-classes"><span class="secno">3.5. </span><span class="content"> Pseudo-classes</span><a class="self-link" href="#pseudo-classes"></a></h3> <p><dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="pseudo-class" id="pseudo-class">Pseudo-classes</dfn> are <a data-link-type="dfn" href="#simple" id="ref-for-simple①②">simple selectors</a> that permit selection based on information that lies outside of the document tree or that can be awkward or impossible to express using the other simple selectors. They can also be dynamic, in the sense that an element can acquire or lose a pseudo-class while a user interacts with the document, without the document itself changing. <a data-link-type="dfn" href="#pseudo-class" id="ref-for-pseudo-class④">Pseudo-classes</a> do not appear in or modify the document source or document tree.</p> <p>The syntax of a <a data-link-type="dfn" href="#pseudo-class" id="ref-for-pseudo-class⑤">pseudo-class</a> consists of a ":" (U+003A COLON) followed by the name of the <span id="ref-for-pseudo-class⑥">pseudo-class</span> as a CSS <a data-link-type="dfn" href="https://drafts.csswg.org/css-values-4/#css-css-identifier" id="ref-for-css-css-identifier">identifier</a>, and, in the case of a <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="functional-pseudo-class">functional pseudo-class</dfn>, a pair of parentheses containing its arguments.</p> <p class="example" id="example-86ae2021"><a class="self-link" href="#example-86ae2021"></a> For example, <a class="css" data-link-type="maybe" href="#valid-pseudo" id="ref-for-valid-pseudo">:valid</a> is a regular pseudo-class, and <a class="css" data-link-type="maybe" href="#lang-pseudo" id="ref-for-lang-pseudo①">:lang()</a> is a <a data-link-type="dfn" href="#functional-pseudo-class" id="ref-for-functional-pseudo-class">functional pseudo-class</a>. </p> <p>Like all CSS keywords, <a data-link-type="dfn" href="#pseudo-class" id="ref-for-pseudo-class⑦">pseudo-class</a> names are <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive">ASCII case-insensitive</a>. No <a data-link-type="dfn" href="#whitespace" id="ref-for-whitespace">white space</a> is allowed between the colon and the name of the <span id="ref-for-pseudo-class⑧">pseudo-class</span>, nor, as usual for CSS syntax, between a <a data-link-type="dfn" href="#functional-pseudo-class" id="ref-for-functional-pseudo-class①">functional pseudo-class</a>’s name and its opening parenthesis (which thus form a CSS <a data-link-type="dfn">function token</a>). Also as usual, <span id="ref-for-whitespace①">white space</span> is allowed around the arguments inside the parentheses of a functional pseudo-class unless otherwise specified.</p> <p>Like other <a data-link-type="dfn" href="#simple" id="ref-for-simple①③">simple selectors</a>, <a data-link-type="dfn" href="#pseudo-class" id="ref-for-pseudo-class⑨">pseudo-classes</a> are allowed in all <a data-link-type="dfn" href="#compound" id="ref-for-compound②③">compound selectors</a> contained in a selector, and must follow the <a data-link-type="dfn" href="#type-selector" id="ref-for-type-selector②">type selector</a> or <a data-link-type="dfn" href="#universal-selector" id="ref-for-universal-selector③">universal selector</a>, if present.</p> <p class="note" role="note"><span class="marker">Note:</span> Some <a data-link-type="dfn" href="#pseudo-class" id="ref-for-pseudo-class①⓪">pseudo-classes</a> are mutually exclusive (such that a <a data-link-type="dfn" href="#compound" id="ref-for-compound②④">compound selector</a> containing them, while valid, will never match anything), while others can apply simultaneously to the same element.</p> <h3 class="heading settled" data-level="3.6" id="pseudo-elements"><span class="secno">3.6. </span><span class="content">Pseudo-elements</span><a class="self-link" href="#pseudo-elements"></a></h3> <p>Similar to how certain <a data-link-type="dfn" href="#pseudo-class" id="ref-for-pseudo-class①①">pseudo-classes</a> represent additional state information not directly present in the document tree, a <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="pseudo-element">pseudo-element</dfn> represents an <em>element</em> not directly present in the document tree. They are used to create abstractions about the document tree beyond those provided by the document tree. For example, pseudo-elements can be used to select portions of the document that do not correspond to a document-language element (including such ranges as don’t align to element boundaries or fit within its tree structure); that represent content not in the document tree or in an alternate projection of the document tree; or that rely on information provided by styling, layout, user interaction, and other processes that are not reflected in the document tree.</p> <div class="example" id="example-6916597f"> <a class="self-link" href="#example-6916597f"></a> For instance, document languages do not offer mechanisms to access the first letter or first line of an element’s content, but there exist <a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element④">pseudo-elements</a> (<a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-first-letter" id="ref-for-selectordef-first-letter">::first-letter</a> and <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-first-line" id="ref-for-selectordef-first-line②">::first-line</a>) that allow those things to be styled. Notice especially that in the case of <span class="css" id="ref-for-selectordef-first-line③">::first-line</span>, which portion of content is represented by the pseudo-element depends on layout information that cannot be inferred from the document tree. <p><a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element⑤">Pseudo-elements</a> can also represent content that doesn’t exist in the source document at all, such as the <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-before" id="ref-for-selectordef-before②">::before</a> and <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-after" id="ref-for-selectordef-after">::after</a> pseudo-elements which allow additional content to be inserted before or after the contents of any element.</p> </div> <p>Like <a data-link-type="dfn" href="#pseudo-class" id="ref-for-pseudo-class①②">pseudo-classes</a>, <a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element⑥">pseudo-elements</a> do not appear in or modify the document source or document tree. Accordingly, they also do not affect the interpretation of <a data-link-type="dfn" href="#structural-pseudo-classes" id="ref-for-structural-pseudo-classes">structural pseudo-classes</a> or other selectors pertaining to their <a data-link-type="dfn" href="#originating-element" id="ref-for-originating-element④">originating element</a> or its tree.</p> <p>The host language defines which pseudo-elements exist, their type, and their abilities. Pseudo-elements that exist in CSS are defined in <a data-link-type="biblio" href="#biblio-css21" title="Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification">[CSS21]</a> (Level 2), <a data-link-type="biblio" href="#biblio-select" title="Selectors Level 3">[SELECT]</a> (Level 3), and <a data-link-type="biblio" href="#biblio-css-pseudo-4" title="CSS Pseudo-Elements Module Level 4">[CSS-PSEUDO-4]</a> (Level 4).</p> <h4 class="heading settled" data-level="3.6.1" id="pseudo-element-syntax"><span class="secno">3.6.1. </span><span class="content"> Syntax</span><a class="self-link" href="#pseudo-element-syntax"></a></h4> <p>The syntax of a <a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element⑦">pseudo-element</a> is "::" (two U+003A COLON characters) followed by the name of the <span id="ref-for-pseudo-element⑧">pseudo-element</span> as an <a data-link-type="dfn" href="https://drafts.csswg.org/css-values-4/#css-css-identifier" id="ref-for-css-css-identifier①">identifier</a>, and, in the case of a <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="functional-pseudo-element">functional pseudo-element</dfn>, a pair of parentheses containing its arguments. <span id="ref-for-pseudo-element⑨">Pseudo-element</span> names are <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive①">ASCII case-insensitive</a>. No <a data-link-type="dfn" href="#whitespace" id="ref-for-whitespace②">white space</a> is allowed between the two colons, or between the colons and the name.</p> <p>Because <a href="https://www.w3.org/TR/CSS1">CSS Level 1</a> and <a href="https://www.w3.org/TR/CSS2">CSS Level 2</a> conflated pseudo-elements and pseudo-classes by sharing a single-colon syntax for both, user agents must also accept the previous one-colon notation for the Level 1 & 2 pseudo-elements (<a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-before" id="ref-for-selectordef-before③">::before</a>, <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-after" id="ref-for-selectordef-after①">::after</a>, <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-first-line" id="ref-for-selectordef-first-line④">::first-line</a>, and <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-first-letter" id="ref-for-selectordef-first-letter①">::first-letter</a>). This compatibility notation is not allowed for any other <a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element①⓪">pseudo-elements</a>. However, as this syntax is deprecated, authors should use the Level 3+ double-colon syntax for these <span id="ref-for-pseudo-element①①">pseudo-elements</span>.</p> <p><a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element①②">Pseudo-elements</a> are <a data-link-type="dfn" href="#featureless" id="ref-for-featureless⑥">featureless</a>, and so can’t be matched by any other selector.</p> <h4 class="heading settled" data-level="3.6.2" id="pseudo-element-attachment"><span class="secno">3.6.2. </span><span class="content"> Binding to the Document Tree</span><a class="self-link" href="#pseudo-element-attachment"></a></h4> <p><a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element①③">Pseudo-elements</a> do not exist independently in the tree: they are always bound to another element on the page, called their <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="originating-element">originating element</dfn>. Syntactically, a <span id="ref-for-pseudo-element①④">pseudo-element</span> immediately follows the <a data-link-type="dfn" href="#compound" id="ref-for-compound②⑤">compound selector</a> representing its <a data-link-type="dfn" href="#originating-element" id="ref-for-originating-element⑤">originating element</a>. If this <span id="ref-for-compound②⑥">compound selector</span> is omitted, it is assumed to be the <a data-link-type="dfn" href="#universal-selector" id="ref-for-universal-selector④">universal selector</a> <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/selectors-3/#x" id="ref-for-x①">*</a>.</p> <div class="example" id="example-e6d9ca44"> <a class="self-link" href="#example-e6d9ca44"></a> For example, in the selector <span class="css">div a::before</span>, the <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-color-5/#valdef-lab-a" id="ref-for-valdef-lab-a">a</a> elements matched by the selector are the <a data-link-type="dfn" href="#originating-element" id="ref-for-originating-element⑥">originating elements</a> for the <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-before" id="ref-for-selectordef-before④">::before</a> pseudo-elements attached to them. <p>The selector <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-first-line" id="ref-for-selectordef-first-line⑤">::first-line</a> is equivalent to <span class="css">*::first-line</span>, which selects the <span class="css" id="ref-for-selectordef-first-line⑥">::first-line</span> pseudo-element on <em>every</em> element in the document.</p> </div> <p>When a <a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element①⑤">pseudo-element</a> is encountered in a selector, the part of the selector before the <span id="ref-for-pseudo-element①⑥">pseudo-element</span> selects the <a data-link-type="dfn" href="#originating-element" id="ref-for-originating-element⑦">originating element</a> for the <span id="ref-for-pseudo-element①⑦">pseudo-element</span>; the part of the selector after it, if any, applies to the <span id="ref-for-pseudo-element①⑧">pseudo-element</span> itself. (See below.)</p> <h4 class="heading settled" data-level="3.6.3" id="pseudo-element-states"><span class="secno">3.6.3. </span><span class="content"> Pseudo-classing Pseudo-elements</span><a class="self-link" href="#pseudo-element-states"></a></h4> <p>Certain <a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element①⑨">pseudo-elements</a> may be immediately followed by any combination of certain <a data-link-type="dfn" href="#pseudo-class" id="ref-for-pseudo-class①③">pseudo-classes</a>, in which case the <span id="ref-for-pseudo-element②⓪">pseudo-element</span> is represented only when it is in the corresponding state. This specification allows any <span id="ref-for-pseudo-element②①">pseudo-element</span> to be followed by any combination of the <a data-link-type="dfn" href="#logical-combination-pseudo-classes" id="ref-for-logical-combination-pseudo-classes①">logical combination pseudo-classes</a> and the <a data-link-type="dfn" href="#user-action-pseudo-class" id="ref-for-user-action-pseudo-class①">user action pseudo-classes</a>. Other specifications may allow additional <span id="ref-for-pseudo-class①④">pseudo-classes</span> to be attached to particular <span id="ref-for-pseudo-element②②">pseudo-elements</span>. Combinations that are not explicitly allowed are <a data-link-type="dfn" href="#invalid-selector" id="ref-for-invalid-selector">invalid selectors</a>.</p> <p class="note" role="note"><span class="marker">Note:</span> The <a data-link-type="dfn" href="#logical-combination-pseudo-classes" id="ref-for-logical-combination-pseudo-classes②">logical combination pseudo-classes</a> pass any restrictions on validity of selectors at their position to their arguments.</p> <div class="example" id="example-61c8ad8f"> <a class="self-link" href="#example-61c8ad8f"></a> For example, since the <a class="css" data-link-type="maybe" href="#hover-pseudo" id="ref-for-hover-pseudo">:hover</a> pseudo-class specifies that it can apply to any pseudo-element, <span class="css">::first-line:hover</span> will match when the first line is hovered. However, since neither <a class="css" data-link-type="maybe" href="#focus-pseudo" id="ref-for-focus-pseudo">:focus</a> nor <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-first-line" id="ref-for-selectordef-first-line⑦">::first-line</a> define that <span class="css" id="ref-for-focus-pseudo①">:focus</span> can apply to <span class="css" id="ref-for-selectordef-first-line⑧">::first-line</span>, the selector <span class="css">::first-line:focus</span> will never match anything. <p>Notice that <span class="css">::first-line:hover</span> is very different from <span class="css">:hover::first-line</span>, which matches the first line of any originating element that is hovered! For example, <span class="css">:hover::first-line</span> also matches the first line of a paragraph when the second line of the paragraph is hovered, whereas <span class="css">::first-line:hover</span> only matches if the first line itself is hovered.</p> </div> <h4 class="heading settled" data-level="3.6.4" id="sub-pseudo-elements"><span class="secno">3.6.4. </span><span class="content"> Sub-pseudo-elements</span><a class="self-link" href="#sub-pseudo-elements"></a></h4> <p>Some <a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element②③">pseudo-elements</a> are able to be the <a data-link-type="dfn" href="#originating-element" id="ref-for-originating-element⑧">originating element</a> of other <span id="ref-for-pseudo-element②④">pseudo-elements</span>, which are defined as the <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="sub-pseudo-element" id="sub-pseudo-element">sub-pseudo-elements</dfn> of this <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="originating-pseudo-element">originating pseudo-element</dfn>. For example, when <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-before" id="ref-for-selectordef-before⑤">::before</a> is given a <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-display-4/#valdef-display-list-item" id="ref-for-valdef-display-list-item">list-item</a> <a data-link-type="dfn" href="https://drafts.csswg.org/css-display-4/#display-type" id="ref-for-display-type">display type</a>, it becomes the <a data-link-type="dfn" href="#originating-pseudo-element" id="ref-for-originating-pseudo-element">originating pseudo-element</a> of its <span class="css">::before::marker</span> <a data-link-type="dfn" href="#sub-pseudo-element" id="ref-for-sub-pseudo-element">sub-pseudo-element</a>.</p> <p>Where disambiguation is needed, the term <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="ultimate-originating-element">ultimate originating element</dfn> refers to the real (non-pseudo) element from which a <a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element②⑤">pseudo-element</a> originates.</p> <p>Unless the corresponding <a data-link-type="dfn" href="#sub-pseudo-element" id="ref-for-sub-pseudo-element①">sub-pseudo-element</a> is explicitly defined to exist in another specification, pseudo-element selectors are not valid when compounded to another pseudo-element selector. So, for example, <span class="css">::before::before</span> is an invalid selector, but <span class="css">::before::marker</span> is valid (in implementations that support the <span class="css">::before::marker</span> <span id="ref-for-sub-pseudo-element②">sub-pseudo-element</span>).</p> <h4 class="heading settled" data-level="3.6.5" id="pseudo-element-structure"><span class="secno">3.6.5. </span><span class="content"> Internal Structure</span><a class="self-link" href="#pseudo-element-structure"></a></h4> <p>Some <a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element②⑥">pseudo-elements</a> are defined to have internal structure. These <span id="ref-for-pseudo-element②⑦">pseudo-elements</span> may be followed by child/descendant combinators to express those relationships. Selectors containing <a data-link-type="dfn" href="#selector-combinator" id="ref-for-selector-combinator⑦">combinators</a> after the pseudo-element are otherwise invalid.</p> <div class="example" id="example-3594b9ac"><a class="self-link" href="#example-3594b9ac"></a> For example, <span class="css">::first-letter + span</span> and <span class="css">::first-letter em</span> are invalid selectors. However, if a new <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-scoping-1/#selectordef-shadow" id="ref-for-selectordef-shadow">::shadow</a> pseudo-element were defined to have internal structure, <span class="css">::shadow > p</span> would be a valid selector. </div> <p class="note" role="note"><span class="marker">Note:</span> A future specification may expand the capabilities of existing pseudo-elements, so some of these currently-invalid selectors (e.g. <span class="css">::first-line :any-link</span>) may become valid in the future.</p> <p>The children of such <a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element②⑧">pseudo-elements</a> can simultaneously be children of other elements, too. However, at least in CSS, their rendering must be defined so as to maintain the tree-ness of the <a data-link-type="dfn" href="https://drafts.csswg.org/css-display-4/#box-tree" id="ref-for-box-tree">box tree</a>.</p> <h3 class="heading settled" data-level="3.7" id="case-sensitive"><span class="secno">3.7. </span><span class="content"> Characters and case sensitivity</span><a class="self-link" href="#case-sensitive"></a></h3> <p>All Selectors syntax is <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive②">ASCII case-insensitive</a> (i.e. [a-z] and [A-Z] are equivalent), except for the parts that are not under the control of Selectors: specifically, the case-sensitivity of document language element names, attribute names, and attribute values depends on the document language.</p> <div class="example" id="example-5ac03fca"><a class="self-link" href="#example-5ac03fca"></a> For example, <a href="https://html.spec.whatwg.org/multipage/semantics-other.html#selectors">in HTML, element and attribute names are ASCII case-insensitive</a>, but in XML, they are case-sensitive. </div> <p>Case sensitivity of namespace prefixes is defined in <a data-link-type="biblio" href="#biblio-css3namespace" title="CSS Namespaces Module Level 3">[CSS3NAMESPACE]</a>. Case sensitivity of <a data-link-type="dfn" href="#language-range" id="ref-for-language-range">language ranges</a> is defined in the <a class="css" data-link-type="maybe" href="#lang-pseudo" id="ref-for-lang-pseudo②">:lang()</a> section.</p> <p><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="whitespace">White space</dfn> in Selectors consists of the code points SPACE (U+0020), TAB (U+0009), LINE FEED (U+000A), CARRIAGE RETURN (U+000D), and FORM FEED (U+000C). Other space-like code points, such as EM SPACE (U+2003) and IDEOGRAPHIC SPACE (U+3000), are never considered syntactic white space.</p> <p>Code points in Selectors can be escaped with a backslash according to the same <a href="https://www.w3.org/TR/CSS21/syndata.html#characters">escaping rules</a> as CSS. <a data-link-type="biblio" href="#biblio-css21" title="Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification">[CSS21]</a> Note that escaping a code point “cancels out” any special meaning it may have in Selectors. For example, the selector <span class="css">#foo>a</span> contains a combinator, but <span class="css">#foo\>a</span> instead selects an element with the id <code>foo>a</code>.</p> <h3 class="heading settled" data-level="3.8" id="namespaces"><span class="secno">3.8. </span><span class="content"> Declaring Namespace Prefixes</span><a class="self-link" href="#namespaces"></a></h3> <p>Certain selectors support namespace prefixes. The mechanism by which namespace prefixes are <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="nsdecl">declared</dfn> should be specified by the language that uses Selectors. If the language does not specify a namespace prefix declaration mechanism, then no prefixes are declared. In CSS, namespace prefixes are declared with the <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-namespaces-3/#at-ruledef-namespace" id="ref-for-at-ruledef-namespace">@namespace</a> rule. <a data-link-type="biblio" href="#biblio-css3namespace" title="CSS Namespaces Module Level 3">[CSS3NAMESPACE]</a></p> <h3 class="heading settled" data-level="3.9" id="invalid"><span class="secno">3.9. </span><span class="content"> Invalid Selectors and Error Handling</span><a class="self-link" href="#invalid"></a></h3> <p>User agents must observe the rules for handling <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-local-lt="invalid" data-lt="invalid selector" id="invalid-selector">invalid selectors</dfn>:</p> <ul> <li>a parsing error in a selector, e.g. an unrecognized token or a token which is not allowed at the current parsing point (see overall <a href="#grammar">§ 18 Grammar</a> and per-selector syntax definitions), causes that selector to be invalid. <li>a simple selector containing an <a href="#namespaces">undeclared namespace prefix</a> is invalid <li>a selector containing an invalid simple selector, an invalid combinator or an invalid token is invalid. <li>a selector list containing an invalid selector is invalid. <li>an empty selector, i.e. one that contains no <a data-link-type="dfn" href="#compound" id="ref-for-compound②⑦">compound selector</a>, is invalid. </ul> <p class="note" role="note"><span class="marker">Note:</span> Consistent with CSS’s forwards-compatible parsing principle, UAs <em>must</em> treat as <a data-link-type="dfn" href="#invalid-selector" id="ref-for-invalid-selector①">invalid</a> any pseudo-classes, pseudo-elements, combinators, or other syntactic constructs for which they have no usable level of support. See <a href="#w3c-partial">Partial implementations</a>.</p> <p>An <a data-link-type="dfn" href="#invalid-selector" id="ref-for-invalid-selector②">invalid selector</a> represents, and therefore matches, nothing.</p> <h3 class="heading settled" data-level="3.10" id="legacy-aliasing"><span class="secno">3.10. </span><span class="content"> Legacy Aliases</span><a class="self-link" href="#legacy-aliasing"></a></h3> <p>Some selectors have a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="legacy-selector-alias">legacy selector alias</dfn>. This is a name which, at parse time, is converted to the standard name (and thus does not appear anywhere in any object model representing the selector).</p> <h2 class="heading settled" data-level="4" id="logical-combination"><span class="secno">4. </span><span class="content"> Logical Combinations</span><a class="self-link" href="#logical-combination"></a></h2> <p>Selector logic can be manipulated by <a data-link-type="dfn" href="#compound" id="ref-for-compound②⑧">compounding</a> (logical AND), <a data-link-type="dfn" href="#selector-list" id="ref-for-selector-list⑤">selector lists</a> (logical OR), and the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="logical-combination-pseudo-classes">logical combination pseudo-classes</dfn> <a class="css" data-link-type="maybe" href="#matches-pseudo" id="ref-for-matches-pseudo">:is()</a>, <a class="css" data-link-type="maybe" href="#where-pseudo" id="ref-for-where-pseudo">:where()</a>, and <a class="css" data-link-type="maybe" href="#negation-pseudo" id="ref-for-negation-pseudo">:not()</a>. The <a data-link-type="dfn" href="#logical-combination-pseudo-classes" id="ref-for-logical-combination-pseudo-classes③">logical combination pseudo-classes</a> are allowed anywhere that any other <a data-link-type="dfn" href="#pseudo-class" id="ref-for-pseudo-class①⑤">pseudo-classes</a> are allowed, but pass any restrictions to their arguments. (For example, if only <span id="ref-for-compound②⑨">compound selectors</span> are allowed, then only <span id="ref-for-compound③⓪">compound selectors</span> are valid within an <span class="css" id="ref-for-matches-pseudo①">:is()</span>.)</p> <p class="note" role="note"><span class="marker">Note:</span> Since inside <a class="css" data-link-type="maybe" href="#matches-pseudo" id="ref-for-matches-pseudo②">:is()</a> and <a class="css" data-link-type="maybe" href="#where-pseudo" id="ref-for-where-pseudo①">:where()</a> invalid arguments are dropped without invaliding the <a data-link-type="dfn" href="#pseudo-class" id="ref-for-pseudo-class①⑥">pseudo-class</a> itself, selector arguments that are invalidated by contextual restrictions likewise do not invalidate the <span class="css" id="ref-for-matches-pseudo③">:is()</span> pseudo-class itself.</p> <h3 class="heading settled" data-level="4.1" id="grouping"><span class="secno">4.1. </span><span class="content"> Selector Lists</span><a class="self-link" href="#grouping"></a></h3> <p>A comma-separated list of selectors represents the union of all elements selected by each of the individual selectors in the <a data-link-type="dfn" href="#selector-list" id="ref-for-selector-list⑥">selector list</a>. (A comma is U+002C.) For example, in CSS when several selectors share the same declarations, they may be grouped into a comma-separated list. White space may appear before and/or after the comma.</p> <div class="example" id="example-1930da7e"> <a class="self-link" href="#example-1930da7e"></a> CSS example: In this example, we condense three rules with identical declarations into one. Thus, <pre>h1 { font-family: sans-serif } h2 { font-family: sans-serif } h3 { font-family: sans-serif } </pre> <p>is equivalent to:</p> <pre>h1, h2, h3 { font-family: sans-serif } </pre> </div> <p><strong>Warning</strong>: the equivalence is true in this example because all the selectors are valid selectors. If just one of these selectors were invalid, the entire <a data-link-type="dfn" href="#selector-list" id="ref-for-selector-list⑦">selector list</a> would be invalid. This would invalidate the rule for all three heading elements, whereas in the former case only one of the three individual heading rules would be invalidated.</p> <div class="example" id="example-fd0daa05"> <a class="self-link" href="#example-fd0daa05"></a> Invalid CSS example: <pre>h1 { font-family: sans-serif } h2..foo { font-family: sans-serif } h3 { font-family: sans-serif } </pre> <p>is not equivalent to:</p> <pre>h1, h2..foo, h3 { font-family: sans-serif } </pre> <p>because the above selector (<span class="css">h1, h2..foo, h3</span>) is entirely invalid and the entire style rule is dropped. (When the selectors are not grouped, only the rule for <span class="css">h2..foo</span> is dropped.)</p> </div> <h3 class="heading settled" data-level="4.2" id="matches"><span class="secno">4.2. </span><span class="content"> The Matches-Any Pseudo-class: <a class="css" data-link-type="maybe" href="#matches-pseudo" id="ref-for-matches-pseudo④">:is()</a></span><a class="self-link" href="#matches"></a></h3> <p>The matches-any pseudo-class, <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="matches-pseudo">:is()</dfn>, is a functional pseudo-class taking a <a class="production css" data-link-type="type" href="#typedef-forgiving-selector-list" id="ref-for-typedef-forgiving-selector-list"><forgiving-selector-list></a> as its sole argument.</p> <p>If the argument, after parsing, is an empty list, the pseudo-class is valid but matches nothing. Otherwise, the pseudo-class matches any element that matches any of the selectors in the list.</p> <p class="note" role="note"><span class="marker">Note:</span> The specificity of the <a class="css" data-link-type="maybe" href="#matches-pseudo" id="ref-for-matches-pseudo⑤">:is()</a> pseudo-class is replaced by the specificity of its most specific argument. Thus, a selector written with <span class="css" id="ref-for-matches-pseudo⑥">:is()</span> does not necessarily have equivalent specificity to the equivalent selector written without <span class="css" id="ref-for-matches-pseudo⑦">:is()</span> For example, if we have <span class="css">:is(ul, ol, .list) > [hidden]</span> and <span class="css">ul > [hidden], ol > [hidden], .list > [hidden]</span> a <span class="css">[hidden]</span> child of an <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-ol-element" id="ref-for-the-ol-element">ol</a></code> matches the first selector with a specificity of (0,2,0) whereas it matches the second selector with a specificity of (0,1,1). See <a href="#specificity-rules">§ 17 Calculating a selector’s specificity</a>.</p> <p>Pseudo-elements cannot be represented by the matches-any pseudo-class; they are not valid within <a class="css" data-link-type="maybe" href="#matches-pseudo" id="ref-for-matches-pseudo⑧">:is()</a>.</p> <p>Default namespace declarations do not affect the <a data-link-type="dfn" href="#compound" id="ref-for-compound③①">compound selector</a> representing the <a data-link-type="dfn" href="#selector-subject" id="ref-for-selector-subject①">subject</a> of any selector within a <a class="css" data-link-type="maybe" href="#matches-pseudo" id="ref-for-matches-pseudo⑨">:is()</a> pseudo-class, unless that compound selector contains an explicit <a data-link-type="dfn" href="#universal-selector" id="ref-for-universal-selector⑤">universal selector</a> or <a data-link-type="dfn" href="#type-selector" id="ref-for-type-selector③">type selector</a>.</p> <div class="example" id="example-2cab03ed"> <a class="self-link" href="#example-2cab03ed"></a> For example, the following selector matches any element that is being hovered or focused, regardless of its namespace. In particular, it is not limited to only matching elements in the default namespace that are being hovered or focused. <pre>*|*:is(:hover, :focus) </pre> <p>The following selector, however, represents only hovered or focused elements that are in the default namespace, because it uses an explicit universal selector within the <a class="css" data-link-type="maybe" href="#matches-pseudo" id="ref-for-matches-pseudo①⓪">:is()</a> notation:</p> <pre>*|*:is(*:hover, *:focus) </pre> </div> <p>As previous drafts of this specification used the name <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-matches">:matches()</dfn> for this pseudo-class, UAs may additionally implement this obsolete name as a <a data-link-type="dfn" href="#legacy-selector-alias" id="ref-for-legacy-selector-alias">legacy selector alias</a> for <a class="css" data-link-type="maybe" href="#matches-pseudo" id="ref-for-matches-pseudo①①">:is()</a> if needed for backwards-compatibility.</p> <h3 class="heading settled" data-level="4.3" id="negation"><span class="secno">4.3. </span><span class="content"> The Negation (Matches-None) Pseudo-class: <a class="css" data-link-type="maybe" href="#negation-pseudo" id="ref-for-negation-pseudo①">:not()</a></span><a class="self-link" href="#negation"></a></h3> <p>The negation pseudo-class, <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="negation-pseudo">:not()</dfn>, is a functional pseudo-class taking a <a class="production css" data-link-type="type" href="#typedef-complex-real-selector-list" id="ref-for-typedef-complex-real-selector-list"><complex-real-selector-list></a> as an argument. It represents an element that is not represented by its argument.</p> <p class="note" role="note"><span class="marker">Note:</span> In Selectors Level 3, only a single <a data-link-type="dfn" href="#simple" id="ref-for-simple①④">simple selector</a> was allowed as the argument to <a class="css" data-link-type="maybe" href="#negation-pseudo" id="ref-for-negation-pseudo②">:not()</a>.</p> <p class="note" role="note"><span class="marker">Note:</span> The specificity of the <a class="css" data-link-type="maybe" href="#negation-pseudo" id="ref-for-negation-pseudo③">:not()</a> pseudo-class is replaced by the specificity of the most specific selector in its argument; thus it has the exact behavior of <span class="css">:not(:is(<var>argument</var>))</span>. See <a href="#specificity-rules">§ 17 Calculating a selector’s specificity</a>.</p> <p>Pseudo-elements cannot be represented by the negation pseudo-class; they are not valid within <a class="css" data-link-type="maybe" href="#negation-pseudo" id="ref-for-negation-pseudo④">:not()</a>.</p> <div class="example" id="example-2a176618"> <a class="self-link" href="#example-2a176618"></a> For example, the following selector matches all <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/form-elements.html#the-button-element" id="ref-for-the-button-element">button</a> elements in an HTML document that are not disabled. <pre>button:not([DISABLED]) </pre> <p>The following selector represents all but FOO elements.</p> <pre>*:not(FOO)</pre> <p>The following compound selector represents all HTML elements except links.</p> <pre>html|*:not(:link):not(:visited)</pre> </div> <p>As with <a class="css" data-link-type="maybe" href="#matches-pseudo" id="ref-for-matches-pseudo①②">:is()</a>, default namespace declarations do not affect the <a data-link-type="dfn" href="#compound" id="ref-for-compound③②">compound selector</a> representing the <a data-link-type="dfn" href="#selector-subject" id="ref-for-selector-subject②">subject</a> of any selector within a <a class="css" data-link-type="maybe" href="#negation-pseudo" id="ref-for-negation-pseudo⑤">:not()</a> pseudo-class, unless that compound selector contains an explicit <a data-link-type="dfn" href="#universal-selector" id="ref-for-universal-selector⑥">universal selector</a> or <a data-link-type="dfn" href="#type-selector" id="ref-for-type-selector④">type selector</a>. (See <span class="css" id="ref-for-matches-pseudo①③">:is()</span> for examples.)</p> <p class="note" role="note"><span class="marker">Note:</span> The <a class="css" data-link-type="maybe" href="#negation-pseudo" id="ref-for-negation-pseudo⑥">:not()</a> pseudo-class allows useless selectors to be written. For instance <span class="css">:not(*|*)</span>, which represents no element at all, or <span class="css">div:not(span)</span>, which is equivalent to <span class="css">div</span> but with a higher specificity.</p> <h3 class="heading settled" data-level="4.4" id="zero-matches"><span class="secno">4.4. </span><span class="content"> The Specificity-adjustment Pseudo-class: <a class="css" data-link-type="maybe" href="#where-pseudo" id="ref-for-where-pseudo②">:where()</a></span><a class="self-link" href="#zero-matches"></a></h3> <p>The Specificity-adjustment pseudo-class, <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="where-pseudo">:where()</dfn>, is a functional pseudo-class with the same syntax and functionality as <a class="css" data-link-type="maybe" href="#matches-pseudo" id="ref-for-matches-pseudo①④">:is()</a>. Unlike <span class="css" id="ref-for-matches-pseudo①⑤">:is()</span>, neither the <a class="css" data-link-type="maybe" href="#where-pseudo" id="ref-for-where-pseudo③">:where()</a> pseudo-class, nor any of its arguments, contribute to the <a data-link-type="dfn" href="#specificity" id="ref-for-specificity">specificity</a> of the selector—its <span id="ref-for-specificity①">specificity</span> is always zero.</p> <p>This is useful for introducing filters in a selector while keeping the associated style declarations easy to override.</p> <div class="example" id="example-7ca50acf"> <a class="self-link" href="#example-7ca50acf"></a> Below is a common example where the specificity heuristic fails to match author expectations: <pre>a:not(:hover) { text-decoration: none; } nav a { /* Has no effect */ text-decoration: underline; } </pre> <p>However, by using <a class="css" data-link-type="maybe" href="#where-pseudo" id="ref-for-where-pseudo④">:where()</a> the author can explicitly declare their intent:</p> <pre>a:where(:not(:hover)) { text-decoration: none; } nav a { /* Works now! */ text-decoration: underline; } </pre> </div> <p class="note" role="note"><span class="marker">Note:</span> Future levels of Selectors may introduce an additional argument to explicitly set the specificity of that instance of the pseudo-class.</p> <h3 class="heading settled" data-level="4.5" id="relational"><span class="secno">4.5. </span><span class="content"> The Relational Pseudo-class: <a class="css" data-link-type="maybe" href="#has-pseudo" id="ref-for-has-pseudo②">:has()</a></span><a class="self-link" href="#relational"></a></h3> <p>The relational pseudo-class, <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="has-pseudo">:has()</dfn>, is a functional pseudo-class taking a <a class="production css" data-link-type="type" href="#typedef-relative-selector-list" id="ref-for-typedef-relative-selector-list①"><relative-selector-list></a> as an argument. It represents an element if any of the <a data-link-type="dfn" href="#relative-selector" id="ref-for-relative-selector①">relative selectors</a> would match at least one element when <a data-link-type="dfn" href="#relative-selector-anchor-elements" id="ref-for-relative-selector-anchor-elements②">anchored against</a> this element.</p> <p>The <a class="css" data-link-type="maybe" href="#has-pseudo" id="ref-for-has-pseudo③">:has()</a> pseudo-class cannot be nested; <span class="css" id="ref-for-has-pseudo④">:has()</span> is not valid within <span class="css" id="ref-for-has-pseudo⑤">:has()</span>. Also, unless explicitly defined as a <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="has-allowed-pseudo-element">:has-allowed pseudo-element</dfn>, <a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element②⑨">pseudo-elements</a> are not valid selectors within <span class="css" id="ref-for-has-pseudo⑥">:has()</span>. (This specification does not define any <a data-link-type="dfn" href="#has-allowed-pseudo-element" id="ref-for-has-allowed-pseudo-element">:has-allowed pseudo-elements</a>, but other specifications may do so.)</p> <p class="note" role="note"><span class="marker">Note:</span> Pseudo-elements are generally excluded from <a class="css" data-link-type="maybe" href="#has-pseudo" id="ref-for-has-pseudo⑦">:has()</a> because many of them exist conditionally, based on the styling of their ancestors, so allowing these to be queried by <span class="css" id="ref-for-has-pseudo⑧">:has()</span> would introduce cycles.</p> <p class="note" role="note"><span class="marker">Note:</span> Since <a class="css" data-link-type="maybe" href="#has-pseudo" id="ref-for-has-pseudo⑨">:has()</a> takes a <a class="production css" data-link-type="type" href="#typedef-relative-selector-list" id="ref-for-typedef-relative-selector-list②"><relative-selector-list></a>, its arguments are <em>inherently</em> <a data-link-type="dfn" href="#complex" id="ref-for-complex④">complex selectors</a> (because they start, perhaps implicitly, with a combinator). This means <span class="css" id="ref-for-has-pseudo①⓪">:has()</span> cannot be used in contexts that don’t allow complex selectors; its arguments will be guaranteed to be invalid.</p> <div class="example" id="example-61d52da1"> <a class="self-link" href="#example-61d52da1"></a> For example, the following selector matches only <code><a></code> elements that contain an <code><img></code> child: <pre>a:has(> img)</pre> <p>The following selector matches a <code><dt></code> element immediately followed by another <code><dt></code> element:</p> <pre>dt:has(+ dt)</pre> <p>The following selector matches <code><section></code> elements that don’t contain any heading elements:</p> <pre>section:not(:has(h1, h2, h3, h4, h5, h6))</pre> <p>Note that ordering matters in the above selector. Swapping the nesting of the two pseudo-classes, like:</p> <pre>section:has(:not(h1, h2, h3, h4, h5, h6))</pre> <p>...would result in matching any <code><section></code> element which contains anything that’s not a heading element.</p> </div> <h2 class="heading settled" data-level="5" id="elemental-selectors"><span class="secno">5. </span><span class="content"> Elemental selectors</span><a class="self-link" href="#elemental-selectors"></a></h2> <h3 class="heading settled" data-level="5.1" id="type-selectors"><span class="secno">5.1. </span><span class="content"> Type (tag name) selector</span><a class="self-link" href="#type-selectors"></a></h3> <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="type-selector">type selector</dfn> is the name of a document language element type, and represents an instance of that element type in the document tree.</p> <div class="example" id="example-087f4a77"><a class="self-link" href="#example-087f4a77"></a> For example, the selector <span class="css">h1</span> represents an <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/sections.html#the-h1-element" id="ref-for-the-h1-element">h1</a> element in the document. </div> <p>A <a data-link-type="dfn" href="#type-selector" id="ref-for-type-selector⑤">type selector</a> is written as a <a data-link-type="dfn" href="https://drafts.csswg.org/css-namespaces-3/#css-qualified-name" id="ref-for-css-qualified-name">CSS qualified name</a>: an <a data-link-type="dfn" href="https://drafts.csswg.org/css-values-4/#css-css-identifier" id="ref-for-css-css-identifier②">identifier</a> with an optional namespace prefix. <a data-link-type="biblio" href="#biblio-css3namespace" title="CSS Namespaces Module Level 3">[CSS3NAMESPACE]</a> (See <a href="#type-nmsp">§ 5.3 Namespaces in Elemental Selectors</a>.)</p> <h3 class="heading settled" data-level="5.2" id="the-universal-selector"><span class="secno">5.2. </span><span class="content"> Universal selector </span><a class="self-link" href="#the-universal-selector"></a></h3> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="universal-selector">universal selector</dfn> is a special <a data-link-type="dfn" href="#type-selector" id="ref-for-type-selector⑥">type selector</a>, that represents an element of any element type.</p> <p>It is written as a <a data-link-type="dfn" href="https://drafts.csswg.org/css-namespaces-3/#css-qualified-name" id="ref-for-css-qualified-name①">CSS qualified name</a> with an asterisk (<code>*</code> U+002A) as the local name. Like a <a data-link-type="dfn" href="#type-selector" id="ref-for-type-selector⑦">type selector</a>, the <a data-link-type="dfn" href="#universal-selector" id="ref-for-universal-selector⑦">universal selector</a> can be qualified by a namespace, restricting it to only elements belonging to that namespace, and is affected by a default namespace as defined in <a href="#type-nmsp">§ 5.3 Namespaces in Elemental Selectors</a>.</p> <p>Unless an element is <a data-link-type="dfn" href="#featureless" id="ref-for-featureless⑦">featureless</a>, the presence of a <a data-link-type="dfn" href="#universal-selector" id="ref-for-universal-selector⑧">universal selector</a> has no effect on whether the element matches the selector. (<span id="ref-for-featureless⑧">Featureless</span> elements do not match any selector, including the <span id="ref-for-universal-selector⑨">universal selector</span>.)</p> <div class="example" id="example-0f5d51ca"> <a class="self-link" href="#example-0f5d51ca"></a> <ul> <li> <span class="css">*[hreflang|=en]</span> and <span class="css">[hreflang|=en]</span> are equivalent, <li><span class="css">*.warning</span> and <span class="css">.warning</span> are equivalent, <li><span class="css">*#myid</span> and <span class="css">#myid</span> are equivalent. </ul> </div> <p>The <a data-link-type="dfn" href="#universal-selector" id="ref-for-universal-selector①⓪">universal selector</a> follows the same syntax rules as other <a data-link-type="dfn" href="#type-selector" id="ref-for-type-selector⑧">type selectors</a>: only one can appear per <a data-link-type="dfn" href="#compound" id="ref-for-compound③③">compound selector</a>, and it must be the first <a data-link-type="dfn" href="#simple" id="ref-for-simple①⑤">simple selector</a> in the <span id="ref-for-compound③④">compound selector</span>.</p> <p class="note" role="note"><span class="marker">Note:</span> In some cases, adding a <a data-link-type="dfn" href="#universal-selector" id="ref-for-universal-selector①①">universal selector</a> can make a selector easier to read, even though it has no effect on the matching behavior. For example, <span class="css">div :first-child</span> and <span class="css">div:first-child</span> are somewhat difficult to tell apart at a quick glance, but writing the former as <span class="css">div *:first-child</span> makes the difference obvious.</p> <h3 class="heading settled" data-level="5.3" id="type-nmsp"><span class="secno">5.3. </span><span class="content"> Namespaces in Elemental Selectors</span><a class="self-link" href="#type-nmsp"></a></h3> <p><a data-link-type="dfn" href="#type-selector" id="ref-for-type-selector⑨">Type selectors</a> and <a data-link-type="dfn" href="#universal-selector" id="ref-for-universal-selector①②">universal selectors</a> allow an optional namespace component: a namespace prefix that has been previously <a href="#nsdecl" id="ref-for-nsdecl">declared</a> may be prepended to the element name separated by the namespace separator “vertical bar” (<code>|</code> U+007C). (See, e.g., <a data-link-type="biblio" href="#biblio-xml-names" title="Namespaces in XML 1.0 (Third Edition)">[XML-NAMES]</a> for the use of namespaces in XML.) It has the following meaning in each form:</p> <dl> <dt><code>ns|E</code> <dd> elements with name E in namespace ns <dt><code>*|E</code> <dd> elements with name E in any namespace, including those without a namespace <dt><code>|E</code> <dd> elements with name E without a namespace <dt><code>E</code> <dd> if no default namespace has been <a href="#nsdecl" id="ref-for-nsdecl②">declared</a> for selectors, this is equivalent to *|E. Otherwise it is equivalent to ns|E where ns is the default namespace. </dl> <div class="example" id="example-53e1ab95"> <a class="self-link" href="#example-53e1ab95"></a> CSS examples: <pre>@namespace foo url(http://www.example.com); foo|h1 { color: blue } /* first rule */ foo|* { color: yellow } /* second rule */ |h1 { color: red } /* ...*/ *|h1 { color: green } h1 { color: green } </pre> <p>The first rule (not counting the <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-namespaces-3/#at-ruledef-namespace" id="ref-for-at-ruledef-namespace①">@namespace</a> at-rule) will match only <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/sections.html#the-h1-element" id="ref-for-the-h1-element①">h1</a> elements in the "http://www.example.com" namespace.</p> <p>The second rule will match all elements in the "http://www.example.com" namespace.</p> <p>The third rule will match only <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/sections.html#the-h1-element" id="ref-for-the-h1-element②">h1</a> elements with no namespace.</p> <p>The fourth rule will match <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/sections.html#the-h1-element" id="ref-for-the-h1-element③">h1</a> elements in any namespace (including those without any namespace).</p> <p>The last rule is equivalent to the fourth rule because no default namespace has been defined.</p> </div> <p>If a <a data-link-type="dfn" href="https://drafts.csswg.org/css-namespaces-3/#default-namespace" id="ref-for-default-namespace">default namespace</a> is declared, <a data-link-type="dfn" href="#compound" id="ref-for-compound③⑤">compound selectors</a> without <a data-link-type="dfn" href="#type-selector" id="ref-for-type-selector①⓪">type selectors</a> in them still only match elements in that default namespace.</p> <div class="example" id="example-03281ceb"> <a class="self-link" href="#example-03281ceb"></a> For example, in the following style sheet: <pre>@namespace url("http://example.com/foo"); .special { ... } </pre> <p>The <span class="css">.special</span> selector only matches elements in the "http://example.com/foo" namespace, even though no reference to the type name (which is paired with the namespace in the DOM) appeared.</p> </div> <p>A <a data-link-type="dfn" href="#type-selector" id="ref-for-type-selector①①">type selector</a> or <a data-link-type="dfn" href="#universal-selector" id="ref-for-universal-selector①③">universal selector</a> containing a namespace prefix that has not been previously <a href="#nsdecl" id="ref-for-nsdecl③">declared</a> is an <a data-link-type="dfn" href="#invalid-selector" id="ref-for-invalid-selector③">invalid selector</a>.</p> <h3 class="heading settled" data-level="5.4" id="the-defined-pseudo"><span class="secno">5.4. </span><span class="content"> The Defined Pseudo-class: <a class="css" data-link-type="maybe" href="#defined-pseudo" id="ref-for-defined-pseudo">:defined</a></span><a class="self-link" href="#the-defined-pseudo"></a></h3> <p>In some host languages, elements can have a distinction between being “defined”/“constructed” or not. The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="defined-pseudo">:defined</dfn> <a data-link-type="dfn" href="#pseudo-class" id="ref-for-pseudo-class①⑦">pseudo-class</a> matches elements that are fully defined, as dictated by the host language.</p> <p>If the host language does not have this sort of distinction, all elements in it match <a class="css" data-link-type="maybe" href="#defined-pseudo" id="ref-for-defined-pseudo①">:defined</a>.</p> <div class="example" id="example-cd9dcdb2"> <a class="self-link" href="#example-cd9dcdb2"></a> In HTML, all built-in elements are always considered to be defined, so the following example will always match: <pre class="highlight"><c- k>p</c-><c- p>:</c->defined <c- p>{</c-> ... <c- p>}</c-></pre> <p><a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element" id="ref-for-custom-element">Custom elements</a>, on the other hand, start out <em>un</em>defined, and only become defined when <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/custom-elements.html#element-definition" id="ref-for-element-definition">properly registered</a>. This means the <a class="css" data-link-type="maybe" href="#defined-pseudo" id="ref-for-defined-pseudo②">:defined</a> pseudo-class can be used to hide a custom element until it has been registered:</p> <pre>custom-element { visibility: hidden }</pre> <pre>custom-element:defined { visibility: visible }</pre> </div> <h2 class="heading settled" data-level="6" id="attribute-selectors"><span class="secno">6. </span><span class="content"> Attribute selectors</span><a class="self-link" href="#attribute-selectors"></a></h2> <p>Selectors allow the representation of an element’s attributes. When a selector is used as an expression to match against an element, an <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="attribute-selector">attribute selector</dfn> must be considered to match an element if that element has an attribute that matches the attribute represented by the attribute selector.</p> <p class="issue" id="issue-745ef775"><a class="self-link" href="#issue-745ef775"></a>Add comma-separated syntax for <a href="http://lists.w3.org/Archives/Public/www-style/2011Mar/0215.html">multiple-value matching</a>? e.g. [rel ~= next, prev, up, first, last] </p> <h3 class="heading settled" data-level="6.1" id="attribute-representation"><span class="secno">6.1. </span><span class="content"> Attribute presence and value selectors</span><a class="self-link" href="#attribute-representation"></a></h3> <p>CSS2 introduced four attribute selectors:</p> <dl> <dt><span class="css">[att]</span> <dd> Represents an element with the <code>att</code> attribute, whatever the value of the attribute. <dt><span class="css">[att=val]</span> <dd> Represents an element with the <code>att</code> attribute whose value is exactly "val". <dt><span class="css">[att~=val]</span> <dd> Represents an element with the <code>att</code> attribute whose value is a <a href="#whitespace" id="ref-for-whitespace③">whitespace</a>-separated list of words, one of which is exactly "val". If "val" contains whitespace, it will never represent anything (since the words are <em>separated</em> by spaces). Also if "val" is the empty string, it will never represent anything. <dt><span class="css">[att|=val]</span> <dd> Represents an element with the <code>att</code> attribute, its value either being exactly "val" or beginning with "val" immediately followed by "-" (U+002D). This is primarily intended to allow language subcode matches (e.g., the <code>hreflang</code> attribute on the <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element" id="ref-for-the-a-element②">a</a> element in HTML) as described in BCP 47 (<a data-link-type="biblio" href="#biblio-bcp47" title="Tags for Identifying Languages">[BCP47]</a>) or its successor. For <code>lang</code> (or <code>xml:lang</code>) language subcode matching, please see the <a class="css" data-link-type="maybe" href="#lang-pseudo" id="ref-for-lang-pseudo③">:lang()</a> pseudo-class. </dl> <p>Attribute values must be <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-syntax-3/#typedef-ident-token" id="ref-for-typedef-ident-token"><ident-token></a>s or <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-syntax-3/#typedef-string-token" id="ref-for-typedef-string-token"><string-token></a>s. <a data-link-type="biblio" href="#biblio-css3syn" title="CSS Syntax Module Level 3">[CSS3SYN]</a></p> <div class="example" id="example-52ee808b"> <a class="self-link" href="#example-52ee808b"></a> Examples: <p>The following attribute selector represents an <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/sections.html#the-h1-element" id="ref-for-the-h1-element④">h1</a> element that carries the <code>title</code> attribute, whatever its value:</p> <pre>h1[title]</pre> <p>In the following example, the selector represents a <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-span-element" id="ref-for-the-span-element">span</a> element whose <code>class</code> attribute has exactly the value "example":</p> <pre>span[class="example"]</pre> <p>Multiple attribute selectors can be used to represent several attributes of an element, or several conditions on the same attribute. Here, the selector represents a <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-span-element" id="ref-for-the-span-element①">span</a> element whose <code>hello</code> attribute has exactly the value "Cleveland" and whose <code>goodbye</code> attribute has exactly the value "Columbus":</p> <pre>span[hello="Cleveland"][goodbye="Columbus"]</pre> <p>The following CSS rules illustrate the differences between "=" and "~=". The first selector would match, for example, an <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element" id="ref-for-the-a-element③">a</a> element with the value "copyright copyleft copyeditor" on a <code>rel</code> attribute. The second selector would only match an <span id="ref-for-the-a-element④">a</span> element with an <code>href</code> attribute having the exact value "http://www.w3.org/".</p> <pre>a[rel~="copyright"] { ... } a[href="http://www.w3.org/"] { ... } </pre> <p>The following selector represents an <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element" id="ref-for-the-a-element⑤">a</a> element whose <code>hreflang</code> attribute is exactly "fr".</p> <pre>a[hreflang=fr] </pre> <p>The following selector represents an <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element" id="ref-for-the-a-element⑥">a</a> element for which the value of the <code>hreflang</code> attribute begins with "en", including "en", "en-US", and "en-scouse":</p> <pre>a[hreflang|="en"] </pre> <p>The following selectors represent a <a data-link-type="element">DIALOGUE</a> element whenever it has one of two different values for an attribute <code>character</code>:</p> <pre>DIALOGUE[character=romeo] DIALOGUE[character=juliet] </pre> </div> <h3 class="heading settled" data-level="6.2" id="attribute-substrings"><span class="secno">6.2. </span><span class="content"> Substring matching attribute selectors</span><a class="self-link" href="#attribute-substrings"></a></h3> <p>Three additional attribute selectors are provided for matching substrings in the value of an attribute:</p> <dl> <dt><span class="css">[att^=val]</span> <dd> Represents an element with the <code>att</code> attribute whose value begins with the prefix "val". If "val" is the empty string then the selector does not represent anything. <dt><span class="css">[att$=val]</span> <dd> Represents an element with the <code>att</code> attribute whose value ends with the suffix "val". If "val" is the empty string then the selector does not represent anything. <dt><span class="css">[att*=val]</span> <dd> Represents an element with the <code>att</code> attribute whose value contains at least one instance of the substring "val". If "val" is the empty string then the selector does not represent anything. </dl> <p>Attribute values must be <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-syntax-3/#typedef-ident-token" id="ref-for-typedef-ident-token①"><ident-token></a>s or <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-syntax-3/#typedef-string-token" id="ref-for-typedef-string-token①"><string-token></a>s.</p> <div class="example" id="example-d887e2c3"> <a class="self-link" href="#example-d887e2c3"></a> Examples: The following selector represents an HTML <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-object-element" id="ref-for-the-object-element">object</a> element, referencing an image: <pre>object[type^="image/"] </pre> <p>The following selector represents an HTML <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element" id="ref-for-the-a-element⑦">a</a> element with an <code>href</code> attribute whose value ends with ".html".</p> <pre>a[href$=".html"] </pre> <p>The following selector represents an HTML paragraph with a <code>title</code> attribute whose value contains the substring "hello"</p> <pre>p[title*="hello"] </pre> </div> <h3 class="heading settled" data-level="6.3" id="attribute-case"><span class="secno">6.3. </span><span class="content"> Case-sensitivity</span><a class="self-link" href="#attribute-case"></a></h3> <p>By default case-sensitivity of attribute names and values in selectors depends on the document language.</p> <p>To match attribute values <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive③">ASCII case-insensitively</a> regardless of document language rules, the attribute selector may include the identifier <code>i</code> before the closing bracket (<code>]</code>). When this flag is present, UAs must match the attribute’s value <span id="ref-for-ascii-case-insensitive④">ASCII case-insensitively</span> (i.e. [a-z] and [A-Z] are considered equivalent).</p> <p>Alternately, the attribute selector may include the identifier <code>s</code> before the closing bracket (<code>]</code>); in this case the UA must match the value case-sensitively, with “<a data-link-type="dfn" href="https://infra.spec.whatwg.org/#string-is" id="ref-for-string-is①">identical to</a>” semantics <a data-link-type="biblio" href="#biblio-infra" title="Infra Standard">[INFRA]</a>, regardless of document language rules.</p> <p>Like the rest of Selectors syntax, the <code>i</code> and <code>s</code> identifiers themselves are <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive⑤">ASCII case-insensitive</a>.</p> <div class="example" id="example-348bad1b"> <a class="self-link" href="#example-348bad1b"></a> The following rule will style the <code>frame</code> attribute when it has a value of <code>hsides</code>, whether that value is represented as <code>hsides</code>, <code>HSIDES</code>, <code>hSides</code>, etc. even in an XML environment where attribute values are case-sensitive. <pre>[frame=hsides i] { border-style: solid none; } </pre> </div> <div class="example" id="example-f596236d"> <a class="self-link" href="#example-f596236d"></a> The following rule will style lists with <code>type="a"</code> attributes differently than <code>type="A"</code> even though HTML defines the <code>type</code> attribute to be case-insensitive. <pre>[type="a" s] { list-style: lower-alpha; } [type="A" s] { list-style: upper-alpha; } </pre> </div> <p class="note" role="note"><span class="marker">Note:</span> Some document models normalize case-insensitive attribute values at parse time such that checking if a string is case-sensitive matching is impossible. Case-sensitive matching via <code>s</code> flags is only possible in systems that preserve the original case.</p> <h3 class="heading settled" data-level="6.4" id="attrnmsp"><span class="secno">6.4. </span><span class="content"> Attribute selectors and namespaces</span><a class="self-link" href="#attrnmsp"></a></h3> <p>The attribute name in an attribute selector is given as a <a data-link-type="dfn" href="https://drafts.csswg.org/css-namespaces-3/#css-qualified-name" id="ref-for-css-qualified-name②">CSS qualified name</a>: a namespace prefix that has been previously <a data-link-type="dfn" href="#nsdecl" id="ref-for-nsdecl④">declared</a> may be prepended to the attribute name separated by the namespace separator "vertical bar" (<code>|</code>). In keeping with the Namespaces in the XML recommendation, default namespaces do not apply to attributes, therefore attribute selectors without a namespace component apply only to attributes that have no namespace (equivalent to <span class="css">|attr</span>). An asterisk may be used for the namespace prefix indicating that the selector is to match all attribute names without regard to the attribute’s namespace.</p> <p>An attribute selector with an attribute name containing a namespace prefix that has not been previously <a data-link-type="dfn" href="#nsdecl" id="ref-for-nsdecl①">declared</a> is an invalid selector.</p> <div class="example" id="example-a7ca2cb1"> <a class="self-link" href="#example-a7ca2cb1"></a> CSS examples: <pre>@namespace foo "http://www.example.com"; [foo|att=val] { color: blue } [*|att] { color: yellow } [|att] { color: green } [att] { color: green } </pre> <p>The first rule will match only elements with the attribute <code>att</code> in the "http://www.example.com" namespace with the value "val".</p> <p>The second rule will match only elements with the attribute <code>att</code> regardless of the namespace of the attribute (including no namespace).</p> <p>The last two rules are equivalent and will match only elements with the attribute <code>att</code> where the attribute is not in a namespace.</p> </div> <h3 class="heading settled" data-level="6.5" id="def-values"><span class="secno">6.5. </span><span class="content"> Default attribute values in DTDs</span><a class="self-link" href="#def-values"></a></h3> <p>Attribute selectors represent attribute values in the document tree. How that document tree is constructed is outside the scope of Selectors. In some document formats default attribute values can be defined in a DTD or elsewhere, but these can only be selected by attribute selectors if they appear in the document tree. Selectors should be designed so that they work whether or not the default values are included in the document tree.</p> <p>For example, a XML UA may, but is <em>not</em> required to, read an “external subset” of the DTD, but <em>is</em> required to look for default attribute values in the document’s “internal subset”. (See, e.g., <a data-link-type="biblio" href="#biblio-xml10" title="Extensible Markup Language (XML) 1.0 (Fifth Edition)">[XML10]</a> for definitions of these subsets.) Depending on the UA, a default attribute value defined in the external subset of the DTD might or might not appear in the document tree.</p> <p>A UA that recognizes an XML namespace may, but is not required to use its knowledge of that namespace to treat default attribute values as if they were present in the document. (For example, an XHTML UA is not required to use its built-in knowledge of the XHTML DTD. See, e.g., <a data-link-type="biblio" href="#biblio-xml-names" title="Namespaces in XML 1.0 (Third Edition)">[XML-NAMES]</a> for details on namespaces in XML 1.0.)</p> <p class="note" role="note"><span class="marker">Note:</span> Typically, implementations choose to ignore external subsets. This corresponds to the behavior of non-validating processors as defined by the XML specification.</p> <div class="example" id="example-ba3e8ad8"> <a class="self-link" href="#example-ba3e8ad8"></a> Example: <p>Consider an element <code>EXAMPLE</code> with an attribute <code>radix</code> that has a default value of <code>"decimal"</code>. The DTD fragment might be</p> <pre class="dtd-example"><!ATTLIST EXAMPLE radix (decimal,octal) "decimal"> </pre> <p>If the style sheet contains the rules</p> <pre>EXAMPLE[radix=decimal] { /*... default property settings ...*/ } EXAMPLE[radix=octal] { /*... other settings...*/ } </pre> <p>the first rule might not match elements whose <code>radix</code> attribute is set by default, i.e. not set explicitly. To catch all cases, the attribute selector for the default value must be dropped:</p> <pre>EXAMPLE { /*... default property settings ...*/ } EXAMPLE[radix=octal] { /*... other settings...*/ } </pre> <p>Here, because the selector <span class="css">EXAMPLE[radix=octal]</span> is more specific than the type selector alone, the style declarations in the second rule will override those in the first for elements that have a <code>radix</code> attribute value of <code>"octal"</code>. Care has to be taken that all property declarations that are to apply only to the default case are overridden in the non-default cases' style rules.</p> </div> <h3 class="heading settled" data-level="6.6" id="class-html"><span class="secno">6.6. </span><span class="content"> Class selectors</span><a class="self-link" href="#class-html"></a></h3> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="class-selector">class selector</dfn> is given as a full stop (. U+002E) immediately followed by an identifier. It represents an element belonging to the class identified by the identifier, as defined by the document language. For example, in <a data-link-type="biblio" href="#biblio-html5" title="HTML5">[HTML5]</a>, <a data-link-type="biblio" href="#biblio-svg11" title="Scalable Vector Graphics (SVG) 1.1 (Second Edition)">[SVG11]</a>, and <a data-link-type="biblio" href="#biblio-mathml" title="Mathematical Markup Language (MathML™) 1.01 Specification">[MATHML]</a> membership in a class is given by the <code>class</code> attribute: in these languages it is equivalent to the <code>~=</code> notation applied to the local <code>class</code> attribute (i.e. <code>[class~=<var>identifier</var>]</code>).</p> <div class="example" id="example-f9c08b5b"> <a class="self-link" href="#example-f9c08b5b"></a> CSS examples: <p>We can assign style information to all elements with <code>class~="pastoral"</code> as follows:</p> <pre>*.pastoral { color: green } /* all elements with class~=pastoral */ </pre> <p>or just</p> <pre>.pastoral { color: green } /* all elements with class~=pastoral */ </pre> <p>The following assigns style only to H1 elements with <code>class~="pastoral"</code>:</p> <pre>H1.pastoral { color: green } /* H1 elements with class~=pastoral */ </pre> <p>Given these rules, the first <code>H1</code> instance below would not have green text, while the second would:</p> <pre><H1>Not green</H1> <H1 class="pastoral">Very green</H1> </pre> <p>The following rule matches any <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element" id="ref-for-the-p-element">P</a> element whose <code>class</code> attribute has been assigned a list of <a href="#whitespace" id="ref-for-whitespace④">whitespace</a>-separated values that includes both <code>pastoral</code> and <code>marine</code>:</p> <pre>p.pastoral.marine { color: green } </pre> <p>This rule matches when <code>class="pastoral blue aqua marine"</code> but does not match for <code>class="pastoral blue"</code>.</p> </div> <p class="note" role="note"><span class="marker">Note:</span> Because CSS gives considerable power to the "class" attribute, authors could conceivably design their own "document language" based on elements with almost no associated presentation (such as <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-div-element" id="ref-for-the-div-element">div</a> and <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-span-element" id="ref-for-the-span-element②">span</a> in HTML) and assigning style information through the "class" attribute. Authors should avoid this practice since the structural elements of a document language often have recognized and accepted meanings and author-defined classes may not.</p> <p class="note" role="note"><span class="marker">Note:</span> If an element has multiple class attributes, their values must be concatenated with spaces between the values before searching for the class. As of this time the working group is not aware of any manner in which this situation can be reached, however, so this behavior is explicitly non-normative in this specification.</p> <p>When matching against a document which is in <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-document-quirks" id="ref-for-concept-document-quirks">quirks mode</a>, class names must be matched <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive⑥">ASCII case-insensitively</a>; class selectors are otherwise case-sensitive, only matching class names they are <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#string-is" id="ref-for-string-is②">identical to</a>. <a data-link-type="biblio" href="#biblio-infra" title="Infra Standard">[INFRA]</a></p> <h3 class="heading settled" data-level="6.7" id="id-selectors"><span class="secno">6.7. </span><span class="content"> ID selectors</span><a class="self-link" href="#id-selectors"></a></h3> <p>Document languages may contain attributes that are declared to be of type ID. What makes attributes of type ID special is that no two such attributes can have the same value in a conformant document, regardless of the type of the elements that carry them; whatever the document language, an ID typed attribute can be used to uniquely identify its element. In HTML all ID attributes are named <code>id</code>; XML applications may name ID attributes differently, but the same restriction applies. Which attribute on an element is considered the “ID attribute” is defined by the document language.</p> <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="id-selector">ID selector</dfn> consists of a “number sign” (U+0023, <code>#</code>) immediately followed by the ID value, which must be a CSS <a href="https://www.w3.org/TR/CSS21/syndata.html#value-def-identifier">identifier</a>. An ID selector represents an element instance that has an identifier that matches the identifier in the ID selector. (It is possible in non-conforming documents for multiple elements to match a single ID selector.)</p> <div class="example" id="example-3e8dc597"> <a class="self-link" href="#example-3e8dc597"></a> Examples: The following ID selector represents an <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/sections.html#the-h1-element" id="ref-for-the-h1-element⑤">h1</a> element whose ID-typed attribute has the value "chapter1": <pre>h1#chapter1 </pre> <p>The following ID selector represents any element whose ID-typed attribute has the value "chapter1":</p> <pre>#chapter1 </pre> <p>The following selector represents any element whose ID-typed attribute has the value "z98y".</p> <pre>*#z98y </pre> </div> <p class="note" role="note"><span class="marker">Note:</span> In XML 1.0 <a data-link-type="biblio" href="#biblio-xml10" title="Extensible Markup Language (XML) 1.0 (Fifth Edition)">[XML10]</a>, the information about which attribute contains an element’s IDs is contained in a DTD or a schema. When parsing XML, UAs do not always read the DTD, and thus may not know what the ID of an element is (though a UA may have namespace-specific knowledge that allows it to determine which attribute is the ID attribute for that namespace). If a style sheet author knows or suspects that a UA may not know what the ID of an element is, they should use normal attribute selectors instead: <span class="css">[name=p371]</span> instead of <span class="css">#p371</span>.</p> <p>If an element has multiple ID attributes, all of them must be treated as IDs for that element for the purposes of the ID selector. Such a situation could be reached using mixtures of xml:id, DOM3 Core, XML DTDs, and namespace-specific knowledge.</p> <p>When matching against a document which is in <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-document-quirks" id="ref-for-concept-document-quirks①">quirks mode</a>, IDs must be matched <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive⑦">ASCII case-insensitively</a>; ID selectors are otherwise case-sensitive, only matching IDs they are <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#string-is" id="ref-for-string-is③">identical to</a>. <a data-link-type="biblio" href="#biblio-infra" title="Infra Standard">[INFRA]</a></p> <h2 class="heading settled" data-level="7" id="linguistic-pseudos"><span class="secno">7. </span><span class="content"> Linguistic Pseudo-classes</span><a class="self-link" href="#linguistic-pseudos"></a></h2> <h3 class="heading settled" data-level="7.1" id="the-dir-pseudo"><span class="secno">7.1. </span><span class="content"> The Directionality Pseudo-class: <a class="css" data-link-type="maybe" href="#dir-pseudo" id="ref-for-dir-pseudo">:dir()</a></span><a class="self-link" href="#the-dir-pseudo"></a></h3> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="dir-pseudo">:dir()</dfn> pseudo-class allows the author to write selectors that represent an element based on its directionality as determined by the <a data-link-type="dfn" href="#document-language" id="ref-for-document-language②">document language</a>. For example, <a data-link-type="biblio" href="#biblio-html5" title="HTML5">[HTML5]</a> defines <a href="https://html.spec.whatwg.org/multipage/dom.html#the-directionality">how to determine the directionality of an element</a>, based on a combination of the <code>dir</code> attribute, the surrounding text, and other factors. As another example, the <code>its:dir</code> and <code>dirRule</code> element of the Internationalization Tag Set <a data-link-type="biblio" href="#biblio-its20" title="Internationalization Tag Set (ITS) Version 2.0">[ITS20]</a> are able to define the directionality of an element in <a data-link-type="biblio" href="#biblio-xml10" title="Extensible Markup Language (XML) 1.0 (Fifth Edition)">[XML10]</a>.</p> <p>The <a class="css" data-link-type="maybe" href="#dir-pseudo" id="ref-for-dir-pseudo①">:dir()</a> pseudo-class does not select based on stylistic states—for example, the CSS <a class="property css" data-link-type="property" href="https://drafts.csswg.org/css-writing-modes-3/#propdef-direction" id="ref-for-propdef-direction">direction</a> property does not affect whether it matches.</p> <p>The pseudo-class <span class="css">:dir(ltr)</span> represents an element that has a directionality of left-to-right (<code>ltr</code>). The pseudo-class <span class="css">:dir(rtl)</span> represents an element that has a directionality of right-to-left (<code>rtl</code>). The argument to <a class="css" data-link-type="maybe" href="#dir-pseudo" id="ref-for-dir-pseudo②">:dir()</a> must be a single identifier, otherwise the selector is invalid. White space is optionally allowed between the identifier and the parentheses. Values other than <code>ltr</code> and <code>rtl</code> are not invalid, but do not match anything. (If a future markup spec defines other directionalities, then Selectors may be extended to allow corresponding values.)</p> <p>The difference between <span class="css">:dir(C)</span> and <span class="css">[dir=C]</span> is that <span class="css">[dir=C]</span> only performs a comparison against a given attribute on the element, while the <span class="css">:dir(C)</span> pseudo-class uses the UAs knowledge of the document’s semantics to perform the comparison. For example, in HTML, the directionality of an element inherits so that a child without a <code>dir</code> attribute will have the same directionality as its closest ancestor with a valid <code>dir</code> attribute. As another example, in HTML, an element that matches <span class="css">[dir=auto]</span> will match either <span class="css">:dir(ltr)</span> or <span class="css">:dir(rtl)</span> depending on the resolved directionality of the elements as determined by its contents. <a data-link-type="biblio" href="#biblio-html5" title="HTML5">[HTML5]</a></p> <h3 class="heading settled" data-level="7.2" id="the-lang-pseudo"><span class="secno">7.2. </span><span class="content"> The Language Pseudo-class: <a class="css" data-link-type="maybe" href="#lang-pseudo" id="ref-for-lang-pseudo④">:lang()</a></span><a class="self-link" href="#the-lang-pseudo"></a></h3> <p>If the document language specifies how the (human) <a data-link-type="dfn" href="https://drafts.csswg.org/css-text-4/#content-language" id="ref-for-content-language">content language</a> of an element is determined, it is possible to write selectors that represent an element based on its <span id="ref-for-content-language①">content language</span>. The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="lang-pseudo">:lang()</dfn> pseudo-class, which accepts a comma-separated list of one or more <a data-link-type="dfn" href="#language-range" id="ref-for-language-range①">language ranges</a>, represents an element whose <span id="ref-for-content-language②">content language</span> is one of the languages listed in its argument. Each <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="language-range">language range</dfn> in <a class="css" data-link-type="maybe" href="#lang-pseudo" id="ref-for-lang-pseudo⑤">:lang()</a> must be a valid CSS <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-4/#typedef-ident" id="ref-for-typedef-ident"><ident></a> or <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-4/#string-value" id="ref-for-string-value"><string></a>. (Thus language ranges containing asterisks, for example, must be either correctly escaped or quoted as strings, e.g. <span class="css">:lang(\*-Latn)</span> or <span class="css">:lang("*-Latn")</span>.)</p> <p class="note" role="note"><span class="marker">Note:</span> The <a data-link-type="dfn" href="https://drafts.csswg.org/css-text-4/#content-language" id="ref-for-content-language③">content language</a> of an element is defined by the document language.</p> <p>For example, in HTML <a data-link-type="biblio" href="#biblio-html5" title="HTML5">[HTML5]</a>, the <a data-link-type="dfn" href="https://drafts.csswg.org/css-text-4/#content-language" id="ref-for-content-language④">content language</a> is determined by a combination of the <code>lang</code> attribute, information from <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/semantics.html#meta" id="ref-for-meta">meta</a> elements, and possibly also the protocol (e.g. from HTTP headers). XML languages can use the <code>xml:lang</code> attribute to indicate language information for an element. <a data-link-type="biblio" href="#biblio-xml10" title="Extensible Markup Language (XML) 1.0 (Fifth Edition)">[XML10]</a></p> <p>The element’s <a data-link-type="dfn" href="https://drafts.csswg.org/css-text-4/#content-language" id="ref-for-content-language⑤">content language</a> matches a <a data-link-type="dfn" href="#language-range" id="ref-for-language-range②">language range</a> if its <span id="ref-for-content-language⑥">content language</span>, as represented in BCP 47 syntax, matches the given <span id="ref-for-language-range③">language range</span> in an <i>extended filtering</i> operation per <a data-link-type="biblio" href="#biblio-rfc4647" title="Matching of Language Tags">[RFC4647]</a> <cite>Matching of Language Tags</cite> (section 3.3.2). Both the <span id="ref-for-content-language⑦">content language</span> and the <span id="ref-for-language-range④">language range</span> must be <i>canonicalized</i> and converted to <i>extlang form</i> as per section 4.5 of <a data-link-type="biblio" href="#biblio-rfc5646" title="Tags for Identifying Languages">[RFC5646]</a> prior to the <i>extended filtering</i> operation. The matching is performed case-insensitively within the ASCII range.</p> <p>The <a data-link-type="dfn" href="#language-range" id="ref-for-language-range⑤">language range</a> does not need to be a valid language code to perform this comparison.</p> <p>A <a data-link-type="dfn" href="#language-range" id="ref-for-language-range⑥">language range</a> consisting of an empty string (<span class="css">:lang("")</span>) matches (only) elements whose language is not tagged.</p> <p class="note" role="note"><span class="marker">Note:</span> It is recommended that documents and protocols indicate language using codes from <a data-link-type="biblio" href="#biblio-bcp47" title="Tags for Identifying Languages">[BCP47]</a> or its successor, and in the case of XML-based formats, by means of <code>xml:lang</code> attributes. <a data-link-type="biblio" href="#biblio-xml10" title="Extensible Markup Language (XML) 1.0 (Fifth Edition)">[XML10]</a> See <a href="http://www.w3.org/International/questions/qa-lang-2or3.html">“FAQ: Two-letter or three-letter language codes.”</a></p> <div class="example" id="example-91142d84"> <a class="self-link" href="#example-91142d84"></a> Examples: The two following selectors represent an HTML document that is in Belgian French or German. The two next selectors represent <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-q-element" id="ref-for-the-q-element">q</a> quotations in an arbitrary element in Belgian French or German. <pre>html:lang(fr-be) html:lang(de) :lang(fr-be) > q :lang(de) > q </pre> </div> <p class="note" role="note"><span class="marker">Note:</span> One difference between <span class="css">:lang(C)</span> and the <span class="css">|=</span> operator is that the <span class="css">|=</span> operator only performs a comparison against a given attribute on the element, while the <span class="css">:lang(C)</span> pseudo-class uses the UAs knowledge of the document’s semantics to perform the comparison.</p> <div class="example" id="example-c75c4e33"> <a class="self-link" href="#example-c75c4e33"></a> In this HTML example, only the BODY matches <span class="css">[lang|=fr]</span> (because it has a LANG attribute) but both the BODY and the P match <span class="css">:lang(fr)</span> (because both are in French). The P does not match the <span class="css">[lang|=fr]</span> because it does not have a LANG attribute. <pre><body lang=fr> <p>Je suis français.</p> </body> </pre> </div> <div class="example" id="example-c94037c6"> <a class="self-link" href="#example-c94037c6"></a> Another difference between <span class="css">:lang(C)</span> and the <span class="css">|=</span> operator is that <span class="css">:lang(C)</span> performs implicit wildcard matching. <p>For example, <span class="css">:lang(de-DE)</span> will match all of <span class="css">de-DE</span>, <span class="css">de-DE-1996</span>, <span class="css">de-Latn-DE</span>, <span class="css">de-Latf-DE</span>, <span class="css">de-Latn-DE-1996</span>, whereas of those <span class="css">[lang|=de-DE]</span> will only match <span class="css">de-DE</span> and <span class="css">de-DE-1996</span>.</p> <p>To perform wildcard matching on the first subtag (the primary language), an asterisk must be used: <span class="css">*-CH</span> will match all of <span class="css">de-CH</span>, <span class="css">it-CH</span>, <span class="css">fr-CH</span>, and <span class="css">rm-CH</span>.</p> <p>To select against an element’s lang attribute value using this type of language range match, use both the attribute selector and language pseudo-class together, e.g. <span class="css">[lang]:lang(de-DE)</span>.</p> </div> <p class="note" role="note"><span class="marker">Note:</span> Wildcard language matching and comma-separated lists are new in Level 4.</p> <h2 class="heading settled" data-level="8" id="location"><span class="secno">8. </span><span class="content"> Location Pseudo-classes</span><a class="self-link" href="#location"></a></h2> <h3 class="heading settled" data-level="8.1" id="the-any-link-pseudo"><span class="secno">8.1. </span><span class="content"> The Hyperlink Pseudo-class: <a class="css" data-link-type="maybe" href="#any-link-pseudo" id="ref-for-any-link-pseudo">:any-link</a></span><a class="self-link" href="#the-any-link-pseudo"></a></h3> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="any-link-pseudo">:any-link</dfn> pseudo-class represents an element that acts as the source anchor of a hyperlink. For example, in <a data-link-type="biblio" href="#biblio-html5" title="HTML5">[HTML5]</a>, any <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element" id="ref-for-the-a-element⑧">a</a></code> or <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/image-maps.html#the-area-element" id="ref-for-the-area-element">area</a></code> elements with an <code><a data-link-type="element-sub" href="https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-href" id="ref-for-attr-hyperlink-href">href</a></code> attribute are hyperlinks, and thus match <code>:any-link</code>. It matches an element if the element would match either <a class="css" data-link-type="maybe" href="#link-pseudo" id="ref-for-link-pseudo">:link</a> or <a class="css" data-link-type="maybe" href="#visited-pseudo" id="ref-for-visited-pseudo">:visited</a>, and is equivalent to <span class="css">:is(:link, :visited)</span>.</p> <h3 class="heading settled" data-level="8.2" id="link"><span class="secno">8.2. </span><span class="content"> The Link History Pseudo-classes: <a class="css" data-link-type="maybe" href="#link-pseudo" id="ref-for-link-pseudo①">:link</a> and <a class="css" data-link-type="maybe" href="#visited-pseudo" id="ref-for-visited-pseudo①">:visited</a></span><a class="self-link" href="#link"></a></h3> <p>User agents commonly display unvisited <a href="#the-any-link-pseudo">hyperlinks</a> differently from previously visited ones. Selectors provides the pseudo-classes <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="link-pseudo">:link</dfn> and <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="visited-pseudo">:visited</dfn> to distinguish them:</p> <ul> <li>The <a class="css" data-link-type="maybe" href="#link-pseudo" id="ref-for-link-pseudo②">:link</a> pseudo-class applies to links that have not yet been visited. <li>The <a class="css" data-link-type="maybe" href="#visited-pseudo" id="ref-for-visited-pseudo②">:visited</a> pseudo-class applies once the link has been visited by the user. </ul> <p>After some amount of time, user agents may choose to return a visited link to the (unvisited) <a class="css" data-link-type="maybe" href="#link-pseudo" id="ref-for-link-pseudo③">:link</a> state.</p> <p>The two states are mutually exclusive.</p> <div class="example" id="example-0fcef6cd"> <a class="self-link" href="#example-0fcef6cd"></a> The following selector represents links carrying class <code>footnote</code> and already visited: <pre>.footnote:visited </pre> </div> <p>Since it is possible for style sheet authors to abuse the :link and :visited pseudo-classes to determine which sites a user has visited without the user’s consent, UAs may treat all links as unvisited links or implement other measures to preserve the user’s privacy while rendering visited and unvisited links differently.</p> <h3 class="heading settled" data-level="8.3" id="the-local-link-pseudo"><span class="secno">8.3. </span><span class="content"> The Local Link Pseudo-class: <a class="css" data-link-type="maybe" href="#local-link-pseudo" id="ref-for-local-link-pseudo">:local-link</a></span><a class="self-link" href="#the-local-link-pseudo"></a></h3> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="local-link-pseudo">:local-link</dfn> pseudo-class allows authors to style <a href="#the-any-link-pseudo">hyperlinks</a> based on the users current location within a site. It represents an element that is the source anchor of a hyperlink whose target’s absolute URL matches the element’s own document URL. If the hyperlink’s target includes a fragment URL, then the fragment URL of the current URL must also match; if it does not, then the fragment URL portion of the current URL is not taken into account in the comparison.</p> <div class="example" id="example-d2555a3c"> <a class="self-link" href="#example-d2555a3c"></a> For example, the following rule prevents links targeting the current page from being underlined when they are part of the navigation list: <pre>nav :local-link { text-decoration: none; } </pre> </div> <p class="note" role="note"><span class="marker">Note:</span> The current URL of a page can change as a result of user actions such as activating a link targeting a different fragment within the same page; or by use of the <code>pushState</code> API; as well as by the more obvious actions of navigating to a different page or following a redirect (which could be initiated by protocols such as HTTP, markup instructions such as <code><meta http-equiv="..."></code>, or scripting instructions ). UAs must ensure that <a class="css" data-link-type="maybe" href="#local-link-pseudo" id="ref-for-local-link-pseudo①">:local-link</a>, as well as the <a class="css" data-link-type="maybe" href="#target-pseudo" id="ref-for-target-pseudo">:target</a> and <a class="css" data-link-type="maybe" href="#target-within-pseudo" id="ref-for-target-within-pseudo">:target-within</a> pseudo-classes below, respond correctly to all such changes in state.</p> <h3 class="heading settled" data-level="8.4" id="the-target-pseudo"><span class="secno">8.4. </span><span class="content"> The Target Pseudo-class: <a class="css" data-link-type="maybe" href="#target-pseudo" id="ref-for-target-pseudo①">:target</a></span><a class="self-link" href="#the-target-pseudo"></a></h3> <p>In some document languages, the document’s URL can further point to specific elements <em>within</em> the document via the URL’s <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url-fragment" id="ref-for-concept-url-fragment">fragment</a>. The elements pointed to in this way are the target elements of the document.</p> <div class="example" id="example-b8c5336f"><a class="self-link" href="#example-b8c5336f"></a> In HTML the fragment points to the element in the page with the same ID. The url <code>https://example.com/index.html#section2</code>, for example, points to the element with <code>id="section2"</code> in the document at <code>https://example.com/index.html</code>. </div> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="target-pseudo">:target</dfn> pseudo-class matches the document’s target elements. If the document’s URL has no fragment identifier, then the document has no target elements.</p> <div class="example" id="example-8a386e7c"> <a class="self-link" href="#example-8a386e7c"></a> Example: <pre>p.note:target </pre> <p>This selector represents a <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element" id="ref-for-the-p-element①">p</a></code> element of class <code>note</code> that is the target element of the referring URL.</p> </div> <div class="example" id="example-af403697"> <a class="self-link" href="#example-af403697"></a> CSS example: Here, the <a class="css" data-link-type="maybe" href="#target-pseudo" id="ref-for-target-pseudo②">:target</a> pseudo-class is used to make the target element red and place an image before it, if there is one: <pre>:target { color : red } :target::before { content : url(target.png) } </pre> </div> <h3 class="heading settled" data-level="8.5" id="the-target-within-pseudo"><span class="secno">8.5. </span><span class="content"> The Target Container Pseudo-class: <a class="css" data-link-type="maybe" href="#target-within-pseudo" id="ref-for-target-within-pseudo①">:target-within</a></span><a class="self-link" href="#the-target-within-pseudo"></a></h3> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="target-within-pseudo">:target-within</dfn> pseudo-class applies to any element to which the <a class="css" data-link-type="maybe" href="#target-pseudo" id="ref-for-target-pseudo③">:target</a> pseudo-class applies as well as to any element whose descendant in the <a data-link-type="dfn" href="https://drafts.csswg.org/css-scoping-1/#flat-tree" id="ref-for-flat-tree">flat tree</a> (including non-element nodes, such as text nodes) matches the conditions for matching <span class="css" id="ref-for-target-pseudo④">:target</span>.</p> <h3 class="heading settled" data-level="8.6" id="the-scope-pseudo"><span class="secno">8.6. </span><span class="content"> The Reference Element Pseudo-class: <a class="css" data-link-type="maybe" href="#scope-pseudo" id="ref-for-scope-pseudo">:scope</a></span><a class="self-link" href="#the-scope-pseudo"></a></h3> <p>In some contexts, selectors are matched with respect to one or more <a data-link-type="dfn" href="#scoping-root" id="ref-for-scoping-root②">scoping roots</a>, such as when calling the <code class="idl"><a data-link-type="idl">querySelector()</a></code> method in <a data-link-type="biblio" href="#biblio-dom" title="DOM Standard">[DOM]</a>. The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="scope-pseudo">:scope</dfn> pseudo-class represents this <span id="ref-for-scoping-root③">scoping root</span>, and may be either a true element or a virtual one (such as a <code class="idl"><a data-link-type="idl" href="https://dom.spec.whatwg.org/#documentfragment" id="ref-for-documentfragment">DocumentFragment</a></code>).</p> <p>If there is no <a data-link-type="dfn" href="#scoping-root" id="ref-for-scoping-root④">scoping root</a> then <a class="css" data-link-type="maybe" href="#scope-pseudo" id="ref-for-scope-pseudo①">:scope</a> represents the root of the document (equivalent to <a class="css" data-link-type="maybe" href="#root-pseudo" id="ref-for-root-pseudo">:root</a>). Specifications intending for this pseudo-class to match specific elements rather than the document’s root element must define their <span id="ref-for-scoping-root⑤">scoping root(s)</span>.</p> <p>A virtual <a data-link-type="dfn" href="#scoping-root" id="ref-for-scoping-root⑥">scoping root</a> is some object representing the root of a document fragment, and can be used in selector patterns to represent other elements’ relationships to this <span id="ref-for-scoping-root⑦">scoping root</span>, acting as the parent of any root elements in the document fragment it represents. A virtual <span id="ref-for-scoping-root⑧">scoping root</span> is <a data-link-type="dfn" href="#featureless" id="ref-for-featureless⑨">featureless</a> and cannot be the <a data-link-type="dfn" href="#selector-subject" id="ref-for-selector-subject③">subject of the selector</a>.</p> <div class="example" id="example-ef427647"> <a class="self-link" href="#example-ef427647"></a> For example, if you have a <code class="idl"><a data-link-type="idl" href="https://dom.spec.whatwg.org/#documentfragment" id="ref-for-documentfragment①">DocumentFragment</a></code> <code>df</code>, then <code class="highlight">df<c- p>.</c->querySelectorAll<c- p>(</c-><c- u>":scope > .foo"</c-><c- p>)</c-></code> matches all the <span class="css">.foo</span> elements that are "top-level" in the document fragment (those that have the document fragment as their <code class="idl"><a data-link-type="idl" href="https://dom.spec.whatwg.org/#dom-node-parentnode" id="ref-for-dom-node-parentnode">parentNode</a></code>). <p>However, <code class="highlight">df<c- p>.</c->querySelector<c- p>(</c-><c- u>":scope"</c-><c- p>)</c-></code> will not match anything, as the document fragment itself can’t be the <a data-link-type="dfn" href="#selector-subject" id="ref-for-selector-subject④">subject of the selector</a>.</p> </div> <h2 class="heading settled" data-level="9" id="useraction-pseudos"><span class="secno">9. </span><span class="content"> User Action Pseudo-classes</span><a class="self-link" href="#useraction-pseudos"></a></h2> <p>Interactive user interfaces sometimes change the rendering in response to user actions. Selectors provides several <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="user action pseudo-class" data-noexport id="user-action-pseudo-class">user action pseudo-classes</dfn> for the selection of an element the user is acting on. (In non-interactive user agents, these pseudo-classes are valid, but never match any element.)</p> <p>These pseudo-classes are not mutually exclusive. An element can match several such pseudo-classes at the same time.</p> <div class="example" id="example-fc0139c4"> <a class="self-link" href="#example-fc0139c4"></a> Examples: <pre>a:hover /* user hovers over the link */ a:focus /* user focuses the link */ a:focus:hover /* user hovers over the link while it’s focused */ </pre> </div> <p class="note" role="note"><span class="marker">Note:</span> The specifics of hit-testing, necessary to know when several of the pseudo-classes defined in this section apply, are not yet defined, but will be in the future.</p> <h3 class="heading settled" data-level="9.1" id="the-hover-pseudo"><span class="secno">9.1. </span><span class="content"> The Pointer Hover Pseudo-class: <a class="css" data-link-type="maybe" href="#hover-pseudo" id="ref-for-hover-pseudo①">:hover</a></span><a class="self-link" href="#the-hover-pseudo"></a></h3> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="hover-pseudo">:hover</dfn> 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.</p> <p>An element also matches <a class="css" data-link-type="maybe" href="#hover-pseudo" id="ref-for-hover-pseudo②">:hover</a> if one of its descendants in the <a data-link-type="dfn" href="https://drafts.csswg.org/css-scoping-1/#flat-tree" id="ref-for-flat-tree①">flat tree</a> (including non-element nodes, such as text nodes) matches the above conditions.</p> <p>Document languages may define additional ways in which an element can match <a class="css" data-link-type="maybe" href="#hover-pseudo" id="ref-for-hover-pseudo③">:hover</a>. For example, <a data-link-type="biblio" href="#biblio-html5" title="HTML5">[HTML5]</a> defines a labeled control element as <a href="https://html.spec.whatwg.org/multipage/semantics-other.html#selector-hover">matching <code>:hover</code></a> when its <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/forms.html#the-label-element" id="ref-for-the-label-element">label</a> is hovered.</p> <p class="note" role="note"><span class="marker">Note:</span> Since the <a class="css" data-link-type="maybe" href="#hover-pseudo" id="ref-for-hover-pseudo④">:hover</a> state can apply to an element because its child is designated by a pointing device, it is possible for <span class="css" id="ref-for-hover-pseudo⑤">:hover</span> to apply to an element that is not underneath the pointing device.</p> <h3 class="heading settled" data-level="9.2" id="the-active-pseudo"><span class="secno">9.2. </span><span class="content"> The Activation Pseudo-class: <a class="css" data-link-type="maybe" href="#active-pseudo" id="ref-for-active-pseudo">:active</a></span><a class="self-link" href="#the-active-pseudo"></a></h3> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="active-pseudo">:active</dfn> 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.</p> <p>In addition, the <a class="css" data-link-type="maybe" href="#active-pseudo" id="ref-for-active-pseudo①">:active</a> pseudo-class applies while any generated box of <em>any</em> element (or pseudo-element) is being actively indicated by a pointing device (in the “down” state), e.g. between the time the user presses the primary mouse button and releases it, or while a finger is pressing on a touchscreen.</p> <p class="note" role="note"><span class="marker">Note:</span> <a data-link-type="biblio" href="#biblio-html5" title="HTML5">[HTML5]</a> defines <a href="https://html.spec.whatwg.org/multipage/semantics-other.html#selector-active"> specific conditions for HTML elements to be activated </a>.</p> <p>An element also matches <a class="css" data-link-type="maybe" href="#active-pseudo" id="ref-for-active-pseudo②">:active</a> if one of its descendants in the <a data-link-type="dfn" href="https://drafts.csswg.org/css-scoping-1/#flat-tree" id="ref-for-flat-tree②">flat tree</a> (including non-element nodes, such as text nodes) matches the above conditions.</p> <h3 class="heading settled" data-level="9.3" id="the-focus-pseudo"><span class="secno">9.3. </span><span class="content"> The Input Focus Pseudo-class: <a class="css" data-link-type="maybe" href="#focus-pseudo" id="ref-for-focus-pseudo②">:focus</a></span><a class="self-link" href="#the-focus-pseudo"></a></h3> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="focus-pseudo">:focus</dfn> pseudo-class applies while an element (or pseudo-element) has the focus (accepts keyboard or other forms of input).</p> <p>There may be document language or implementation specific limits on which elements can acquire <a class="css" data-link-type="maybe" href="#focus-pseudo" id="ref-for-focus-pseudo③">:focus</a>. For example, <a data-link-type="biblio" href="#biblio-html" title="HTML Standard">[HTML]</a> defines a list of <a href="https://html.spec.whatwg.org/multipage/interaction.html#focusable-area">focusable areas</a>.</p> <p>Document languages may define additional ways in which an element can match <a class="css" data-link-type="maybe" href="#focus-pseudo" id="ref-for-focus-pseudo④">:focus</a>, except that the <span class="css" id="ref-for-focus-pseudo⑤">:focus</span> pseudo-class must not automatically propagate to the parent element—see <a class="css" data-link-type="maybe" href="#focus-within-pseudo" id="ref-for-focus-within-pseudo">:focus-within</a> if matching on the parent is desired. (<span class="css" id="ref-for-focus-pseudo⑥">:focus</span> may still apply to the parent element if made to propagate due to other mechanisms, but not merely due to being the parent.)</p> <p class="issue" id="issue-1416193e"><a class="self-link" href="#issue-1416193e"></a> There’s a desire from authors to propagate <a class="css" data-link-type="maybe" href="#focus-pseudo" id="ref-for-focus-pseudo⑦">:focus</a> from a form control to its associated <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/forms.html#the-label-element" id="ref-for-the-label-element①">label</a></code> element; the main objection seems to be implementation difficulty. See <a href="https://github.com/w3c/csswg-drafts/issues/397">CSSWG issue (CSS)</a> and <a href="https://github.com/whatwg/html/issues/1632">WHATWG issue (HTML)</a>.</p> <h3 class="heading settled" data-level="9.4" id="the-focus-visible-pseudo"><span class="secno">9.4. </span><span class="content"> The Focus-Indicated Pseudo-class: <a class="css" data-link-type="maybe" href="#focus-visible-pseudo" id="ref-for-focus-visible-pseudo">:focus-visible</a></span><span id="the-focusring-pseudo"></span><span id="focus-ring-pseudo"></span><a class="self-link" href="#the-focus-visible-pseudo"></a></h3> <p>While the <a class="css" data-link-type="maybe" href="#focus-pseudo" id="ref-for-focus-pseudo⑧">:focus</a> <a data-link-type="dfn" href="#pseudo-class" id="ref-for-pseudo-class①⑧">pseudo-class</a> always matches the currently-focused element, UAs only sometimes visibly <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="indicate-focus">indicate focus</dfn> (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 <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="focus-visible-pseudo">:focus-visible</dfn> <span id="ref-for-pseudo-class①⑨">pseudo-class</span> matches a focused element (or pseudo-element) in these situations only, allowing authors to change the appearance of the focus indicator without changing <em>when</em> a focus indicator appears.</p> <div class="example" id="example-c40d8011"> <a class="self-link" href="#example-c40d8011"></a> In this example, all focusable elements get a strong yellow outline on <a class="css" data-link-type="maybe" href="#focus-visible-pseudo" id="ref-for-focus-visible-pseudo①">:focus-visible</a>, and links get both a yellow outline and a yellow background on <span class="css" id="ref-for-focus-visible-pseudo②">:focus-visible</span>. These styles are consistent throughout the page and are easily visible due to their bold styling, but do not appear unless the user is likely to need to understand where page focus is. <pre class="highlight">:root <c- p>{</c-> <c- k>--focus-gold</c-><c- p>:</c-> #ffbf47<c- p>;</c-> <c- p>}</c-> :focus-visible <c- p>{</c-> <c- k>outline</c-><c- p>:</c-> <c- m>3</c-><c- k>px</c-> solid <c- nf>var</c-><c- p>(</c->--focus-gold<c- p>);</c-> <c- p>}</c-> a:focus-visible <c- p>{</c-> <c- k>background-color</c-><c- p>:</c-> <c- nf>var</c-><c- p>(</c->--focus-gold<c- p>);</c-> <c- p>}</c-> </pre> </div> <div class="example" id="example-58f4807d"> <a class="self-link" href="#example-58f4807d"></a> User agents can choose their own heuristics for when to <a data-link-type="dfn" href="#indicate-focus" id="ref-for-indicate-focus">indicate focus</a>; however, the following (non-normative) suggestions can be used as a starting point for when to <span id="ref-for-indicate-focus①">indicate focus</span> on the currently focused element: <ul> <li data-md> <p>If the user has expressed a preference (such as via a system preference or a browser setting) to always see a visible focus indicator, <a data-link-type="dfn" href="#indicate-focus" id="ref-for-indicate-focus②">indicate focus</a> regardless of any other factors. (Another option may be for the user agent to show its own focus indicator regardless of author styles.)</p> <li data-md> <p>If the element which supports keyboard input (such as an <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/input.html#the-input-element" id="ref-for-the-input-element">input</a></code> element, or any other element that would triggers a virtual keyboard to be shown on focus if a physical keyboard were not present), <a data-link-type="dfn" href="#indicate-focus" id="ref-for-indicate-focus③">indicate focus</a>.</p> <li data-md> <p>If the user interacts with the page via keyboard or some other non-pointing device, <a data-link-type="dfn" href="#indicate-focus" id="ref-for-indicate-focus④">indicate focus</a>. (This means keyboard usage may change whether this pseudo-class matches even if it doesn’t affect <a class="css" data-link-type="maybe" href="#focus-pseudo" id="ref-for-focus-pseudo⑨">:focus</a>).</p> <li data-md> <p>If the user interacts with the page via a pointing device (mouse, touchscreen, etc.) and the focused element does not support keyboard input, don’t <a data-link-type="dfn" href="#indicate-focus" id="ref-for-indicate-focus⑤">indicate focus</a>.</p> <li data-md> <p>If the previously-focused element <a data-link-type="dfn" href="#indicate-focus" id="ref-for-indicate-focus⑥">indicated focus</a>, and a script causes focus to move elsewhere, <span id="ref-for-indicate-focus⑦">indicate focus</span> on the newly focused element.</p> <p>Conversely, if the previously-focused element did not <a data-link-type="dfn" href="#indicate-focus" id="ref-for-indicate-focus⑧">indicate focus</a>, and a script causes focus to move elsewhere, don’t <span id="ref-for-indicate-focus⑨">indicate focus</span> on the newly focused element.</p> <li data-md> <p>If a newly-displayed element automatically gains focus (such as an action button in a freshly opened dialog), that element should <a data-link-type="dfn" href="#indicate-focus" id="ref-for-indicate-focus①⓪">indicate focus</a>.</p> </ul> </div> <p>User agents should also use <a class="css" data-link-type="maybe" href="#focus-visible-pseudo" id="ref-for-focus-visible-pseudo③">:focus-visible</a> to specify the default focus style, so that authors using <span class="css" id="ref-for-focus-visible-pseudo④">:focus-visible</span> will not also need to disable the default <a class="css" data-link-type="maybe" href="#focus-pseudo" id="ref-for-focus-pseudo①⓪">:focus</a> style.</p> <h3 class="heading settled" data-level="9.5" id="the-focus-within-pseudo"><span class="secno">9.5. </span><span class="content"> The Focus Container Pseudo-class: <a class="css" data-link-type="maybe" href="#focus-within-pseudo" id="ref-for-focus-within-pseudo①">:focus-within</a></span><a class="self-link" href="#the-focus-within-pseudo"></a></h3> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="focus-within-pseudo">:focus-within</dfn> pseudo-class applies to any element (or pseudo-element) for which the <a class="css" data-link-type="maybe" href="#focus-pseudo" id="ref-for-focus-pseudo①①">:focus</a> pseudo-class applies, as well as to an element (or pseudo-element) whose descendant in the <a data-link-type="dfn" href="https://drafts.csswg.org/css-scoping-1/#flat-tree" id="ref-for-flat-tree③">flat tree</a> (including non-element nodes, such as text nodes) matches the conditions for matching <span class="css" id="ref-for-focus-pseudo①②">:focus</span>.</p> <h2 class="heading settled" data-level="10" id="time-pseudos"><span class="secno">10. </span><span class="content"> Time-dimensional Pseudo-classes</span><a class="self-link" href="#time-pseudos"></a></h2> <p>These pseudo-classes classify elements with respect to the currently-displayed or active position in some timeline, such as during speech rendering of a document, or during the display of a video using WebVTT to render subtitles.</p> <p>CSS does not define this timeline; the host language must do so. If there is no timeline defined for an element, these pseudo-classes must not match the element.</p> <p class="note" role="note"><span class="marker">Note:</span> Ancestors of a <a class="css" data-link-type="maybe" href="#current-pseudo" id="ref-for-current-pseudo①">:current</a> element are also <span class="css" id="ref-for-current-pseudo②">:current</span>, but ancestors of a <a class="css" data-link-type="maybe" href="#past-pseudo" id="ref-for-past-pseudo">:past</a> or <a class="css" data-link-type="maybe" href="#future-pseudo" id="ref-for-future-pseudo">:future</a> element are not necessarily <span class="css" id="ref-for-past-pseudo①">:past</span> or <span class="css" id="ref-for-future-pseudo①">:future</span> as well. A given element matches at most one of <span class="css" id="ref-for-current-pseudo③">:current</span>, <span class="css" id="ref-for-past-pseudo②">:past</span>, or <span class="css" id="ref-for-future-pseudo②">:future</span>.</p> <h3 class="heading settled" data-level="10.1" id="the-current-pseudo"><span class="secno">10.1. </span><span class="content"> The Current-element Pseudo-class: <a class="css" data-link-type="maybe" href="#current-pseudo" id="ref-for-current-pseudo④">:current</a></span><a class="self-link" href="#the-current-pseudo"></a></h3> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="current-pseudo">:current</dfn> pseudo-class represents the element, or an ancestor of the element, that is currently being displayed.</p> <p>Its alternate form <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-current">:current()</dfn>, like <a class="css" data-link-type="maybe" href="#matches-pseudo" id="ref-for-matches-pseudo①⑥">:is()</a>, takes a list of <a data-link-type="dfn" href="#compound" id="ref-for-compound③⑥">compound selectors</a> as its argument: it represents the <a class="css" data-link-type="maybe" href="#current-pseudo" id="ref-for-current-pseudo⑤">:current</a> element that matches the argument or, if that does not match, the innermost ancestor of the <span class="css" id="ref-for-current-pseudo⑥">:current</span> element that does. (If neither the <span class="css" id="ref-for-current-pseudo⑦">:current</span> element nor its ancestors match the argument, then the selector does not represent anything.)</p> <div class="example" id="example-34db2617"> <a class="self-link" href="#example-34db2617"></a> For example, the following rule will highlight whichever paragraph or list item is being read aloud in a speech rendering of the document: <pre>:current(p, li, dt, dd) { background: yellow; } </pre> </div> <h3 class="heading settled" data-level="10.2" id="the-past-pseudo"><span class="secno">10.2. </span><span class="content"> The Past-element Pseudo-class: <a class="css" data-link-type="maybe" href="#past-pseudo" id="ref-for-past-pseudo③">:past</a></span><a class="self-link" href="#the-past-pseudo"></a></h3> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="past-pseudo">:past</dfn> pseudo-class represents any element that is defined to occur entirely prior to a <a class="css" data-link-type="maybe" href="#current-pseudo" id="ref-for-current-pseudo⑧">:current</a> element. For example, the WebVTT spec defines the <a class="css" data-link-type="maybe" href="#past-pseudo" id="ref-for-past-pseudo④">:past</a> pseudo-class <a href="http://dev.w3.org/html5/webvtt/#the-past-and-future-pseudo-classes">relative to the current playback position of a media element</a>. 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 <span class="css" id="ref-for-current-pseudo⑨">:current</span> element.</p> <h3 class="heading settled" data-level="10.3" id="the-future-pseudo"><span class="secno">10.3. </span><span class="content"> The Future-element Pseudo-class: <a class="css" data-link-type="maybe" href="#future-pseudo" id="ref-for-future-pseudo③">:future</a></span><a class="self-link" href="#the-future-pseudo"></a></h3> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="future-pseudo">:future</dfn> pseudo-class represents any element that is defined to occur entirely after a <a class="css" data-link-type="maybe" href="#current-pseudo" id="ref-for-current-pseudo①⓪">:current</a> element. For example, the WebVTT spec defines the <a class="css" data-link-type="maybe" href="#future-pseudo" id="ref-for-future-pseudo④">:future</a> pseudo-class <a href="http://dev.w3.org/html5/webvtt/#the-past-and-future-pseudo-classes">relative to the current playback position of a media element</a>. 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 <span class="css" id="ref-for-current-pseudo①①">:current</span> element.</p> <h2 class="heading settled" data-level="11" id="resource-pseudos"><span class="secno">11. </span><span class="content"> Resource State Pseudo-classes</span><a class="self-link" href="#resource-pseudos"></a></h2> <p>The pseudo-classes in this section apply to elements that represent loaded resources, particularly images/videos, and allow authors to select them based on some quality of their state.</p> <h3 class="heading settled" data-level="11.1" id="video-state"><span class="secno">11.1. </span><span class="content"> Media Playback State: the <a class="css" data-link-type="maybe" href="#selectordef-playing" id="ref-for-selectordef-playing">:playing</a>, <a class="css" data-link-type="maybe" href="#selectordef-paused" id="ref-for-selectordef-paused">:paused</a>, and <a class="css" data-link-type="maybe" href="#selectordef-seeking" id="ref-for-selectordef-seeking">:seeking</a> pseudo-classes</span><a class="self-link" href="#video-state"></a></h3> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-playing">:playing</dfn> 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.)</p> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-paused">:paused</dfn> pseudo-class represents an element that is capable of being “played” or “paused”, when that element is “paused” (i.e. <em>not</em> ”playing”). (This includes both an explicit “paused” state, and other non-playing states like “loaded, hasn’t been activated yet”, etc.)</p> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-seeking">:seeking</dfn> pseudo-class represents an element that is capable of ”seeking” when that element is ”seeking”. (For the <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/media.html#audio" id="ref-for-audio">audio</a></code> and <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/media.html#video" id="ref-for-video">video</a></code> elements of HTML, see <a href="https://html.spec.whatwg.org/multipage/media.html#seeking"><cite>HTML</cite> § 4.8.11.9 Seeking</a>.)</p> <h3 class="heading settled" data-level="11.2" id="media-loading-state"><span class="secno">11.2. </span><span class="content"> Media Loading State: the <a class="css" data-link-type="maybe" href="#selectordef-buffering" id="ref-for-selectordef-buffering">:buffering</a> and <a class="css" data-link-type="maybe" href="#selectordef-stalled" id="ref-for-selectordef-stalled">:stalled</a> pseudo-classes</span><a class="self-link" href="#media-loading-state"></a></h3> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-buffering">:buffering</dfn> 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 <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#media-data" id="ref-for-media-data">media data</a> 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 <a class="css" data-link-type="maybe" href="#selectordef-buffering" id="ref-for-selectordef-buffering①">:buffering</a> matches an element, <a class="css" data-link-type="maybe" href="#selectordef-playing" id="ref-for-selectordef-playing①">:playing</a> also matches the element.)</p> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-stalled">:stalled</dfn> pseudo-class represents an element when that element cannot continue playing because it is actively attempting to obtain <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#media-data" id="ref-for-media-data①">media data</a> but it has failed to receive any data for some amount of time. For the <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/media.html#audio" id="ref-for-audio①">audio</a></code> and <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/media.html#video" id="ref-for-video①">video</a></code> elements of HTML, this amount of time is the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#stall-timeout" id="ref-for-stall-timeout">media element stall timeout</a>. <a data-link-type="biblio" href="#biblio-html" title="HTML Standard">[HTML]</a> (Note that, like with the <a class="css" data-link-type="maybe" href="#selectordef-buffering" id="ref-for-selectordef-buffering②">:buffering</a> pseudo-class, the element is still considered to be “playing” when it is “stalled”. Whenever <a class="css" data-link-type="maybe" href="#selectordef-stalled" id="ref-for-selectordef-stalled①">:stalled</a> matches an element, <a class="css" data-link-type="maybe" href="#selectordef-playing" id="ref-for-selectordef-playing②">:playing</a> also matches the element.)</p> <h3 class="heading settled" data-level="11.3" id="sound-state"><span class="secno">11.3. </span><span class="content"> Sound State: the <a class="css" data-link-type="maybe" href="#selectordef-muted" id="ref-for-selectordef-muted">:muted</a> and <a class="css" data-link-type="maybe" href="#selectordef-volume-locked" id="ref-for-selectordef-volume-locked">:volume-locked</a> pseudo-classes</span><a class="self-link" href="#sound-state"></a></h3> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-muted">:muted</dfn> pseudo-class represents an element that is capable of making sound, but is currently “muted“ (forced silent). (For the <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/media.html#audio" id="ref-for-audio②">audio</a></code> and <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/media.html#video" id="ref-for-video②">video</a></code> elements of HTML, see <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#concept-media-muted" id="ref-for-concept-media-muted">muted</a>. <a data-link-type="biblio" href="#biblio-html" title="HTML Standard">[HTML]</a>)</p> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-volume-locked">:volume-locked</dfn> 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 <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/media.html#audio" id="ref-for-audio③">audio</a></code> and <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/media.html#video" id="ref-for-video③">video</a></code> elements of HTML, see the algorithm for setting the element’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/media.html#effective-media-volume" id="ref-for-effective-media-volume">effective media volume</a>. <a data-link-type="biblio" href="#biblio-html" title="HTML Standard">[HTML]</a>)</p> <h2 class="heading settled" data-level="12" id="display-state-pseudos"><span class="secno">12. </span><span class="content"> Element Display State Pseudo-classes</span><a class="self-link" href="#display-state-pseudos"></a></h2> <h3 class="heading settled" data-level="12.1" id="open-state"><span class="secno">12.1. </span><span class="content"> Collapse State: the <a class="css" data-link-type="maybe" href="#selectordef-open" id="ref-for-selectordef-open">:open</a> and <a class="css" data-link-type="maybe" href="#selectordef-closed" id="ref-for-selectordef-closed">:closed</a> pseudo-class</span><a class="self-link" href="#open-state"></a></h3> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-open">:open</dfn> pseudo-class represents an element that has both “open” and “closed” states, and which is currently in the “open” state.</p> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-closed">:closed</dfn> pseudo-class represents an element that has both “open” and “closed” states, and which is currently in the closed state.</p> <p>Exactly what “open” and “closed” mean is host-language specific, but exemplified by elements such as HTML’s <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/interactive-elements.html#the-details-element" id="ref-for-the-details-element">details</a></code>, <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/form-elements.html#the-select-element" id="ref-for-the-select-element">select</a></code>, and <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/interactive-elements.html#the-dialog-element" id="ref-for-the-dialog-element">dialog</a></code> elements, all of which can be toggled “open” to display more content (or any content at all, in the case of <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/interactive-elements.html#the-dialog-element" id="ref-for-the-dialog-element①">dialog</a></code>).</p> <p class="note" role="note"><span class="marker">Note:</span> Being “open” or “closed” is a semantic state. An element not currently being displayed (for example, one that has <a class="css" data-link-type="propdesc" href="https://drafts.csswg.org/css-display-4/#propdef-visibility" id="ref-for-propdef-visibility">visibility: collapse</a>, or belongs to a <a class="css" data-link-type="propdesc" href="https://drafts.csswg.org/css-display-3/#propdef-display" id="ref-for-propdef-display">display: none</a> subtree) can still be “open” and will match <a class="css" data-link-type="maybe" href="#selectordef-open" id="ref-for-selectordef-open①">:open</a>.</p> <h3 class="heading settled" data-level="12.2" id="modal-state"><span class="secno">12.2. </span><span class="content"> Modal (Exclusive Interaction) State: the <a class="css" data-link-type="maybe" href="#selectordef-modal" id="ref-for-selectordef-modal">:modal</a> pseudo-class</span><a class="self-link" href="#modal-state"></a></h3> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-modal">:modal</dfn> 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 <a class="css" data-link-type="maybe" href="#selectordef-modal" id="ref-for-selectordef-modal①">:modal</a> simultaneously, with only one of them active (able to receive input).</p> <div class="example" id="example-82b2b6f1"><a class="self-link" href="#example-82b2b6f1"></a> For example, the <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/interactive-elements.html#the-dialog-element" id="ref-for-the-dialog-element②">dialog</a></code> element is <a class="css" data-link-type="maybe" href="#selectordef-modal" id="ref-for-selectordef-modal②">:modal</a> when opened with the <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/interactive-elements.html#dom-dialog-showmodal" id="ref-for-dom-dialog-showmodal">showModal()</a></code> API. Similarly, a <a class="css" data-link-type="maybe" href="#selectordef-fullscreen" id="ref-for-selectordef-fullscreen">:fullscreen</a> element is also <span class="css" id="ref-for-selectordef-modal③">:modal</span> when opened with the <code class="idl"><a data-link-type="idl" href="https://fullscreen.spec.whatwg.org/#dom-element-requestfullscreen" id="ref-for-dom-element-requestfullscreen">requestFullscreen()</a></code> API, since this prevents interaction with the rest of the page. </div> <h3 class="heading settled" data-level="12.3" id="fullscreen-state"><span class="secno">12.3. </span><span class="content"> Fullscreen Presentation State: the <a class="css" data-link-type="maybe" href="#selectordef-fullscreen" id="ref-for-selectordef-fullscreen①">:fullscreen</a> pseudo-class</span><a class="self-link" href="#fullscreen-state"></a></h3> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-fullscreen">:fullscreen</dfn> 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. <a data-link-type="biblio" href="#biblio-fullscreen" title="Fullscreen API Standard">[FULLSCREEN]</a></p> <h3 class="heading settled" data-level="12.4" id="pip-state"><span class="secno">12.4. </span><span class="content"> Picture-in-Picture Presentation State: the <a class="css" data-link-type="maybe" href="#selectordef-picture-in-picture" id="ref-for-selectordef-picture-in-picture">:picture-in-picture</a> pseudo-class</span><a class="self-link" href="#pip-state"></a></h3> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-picture-in-picture">:picture-in-picture</dfn> pseudo-class represents an element which is displayed in a mode that takes up most (usually all) of the viewport, and whose viewport is confined to part of the screen while being displayed over other content, for example when using the Picture-in-Picture API. <a data-link-type="biblio" href="#biblio-picture-in-picture" title="Picture-in-Picture">[picture-in-picture]</a></p> <h2 class="heading settled" data-level="13" id="input-pseudos"><span class="secno">13. </span><span class="content"> The Input Pseudo-classes</span><a class="self-link" href="#input-pseudos"></a></h2> <p>The pseudo-classes in this section mostly apply to elements that take user input, such as HTML’s <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/input.html#the-input-element" id="ref-for-the-input-element①">input</a> element.</p> <h3 class="heading settled" data-level="13.1" id="input-states"><span class="secno">13.1. </span><span class="content"> Input Control States</span><a class="self-link" href="#input-states"></a></h3> <h4 class="heading settled" data-level="13.1.1" id="enableddisabled"><span class="secno">13.1.1. </span><span class="content"> The <a class="css" data-link-type="maybe" href="#enabled-pseudo" id="ref-for-enabled-pseudo">:enabled</a> and <a class="css" data-link-type="maybe" href="#disabled-pseudo" id="ref-for-disabled-pseudo">:disabled</a> Pseudo-classes</span><a class="self-link" href="#enableddisabled"></a></h4> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="enabled-pseudo">:enabled</dfn> pseudo-class represents user interface elements that are in an enabled state; such elements must have a corresponding disabled state.</p> <p>Conversely, the <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="disabled-pseudo">:disabled</dfn> pseudo-class represents user interface elements that are in a disabled state; such elements must have a corresponding enabled state.</p> <p>What constitutes an enabled state, a disabled state, and a user interface element is host-language-dependent. In a typical document most elements will be neither <a class="css" data-link-type="maybe" href="#enabled-pseudo" id="ref-for-enabled-pseudo①">:enabled</a> nor <a class="css" data-link-type="maybe" href="#disabled-pseudo" id="ref-for-disabled-pseudo①">:disabled</a>. For example, <a data-link-type="biblio" href="#biblio-html5" title="HTML5">[HTML5]</a> defines <a href="https://html.spec.whatwg.org/multipage/semantics-other.html#selector-enabled">non-disabled interactive elements</a> to be <span class="css" id="ref-for-enabled-pseudo②">:enabled</span>, and any such elements that are <a href="https://html.spec.whatwg.org/multipage/semantics-other.html#selector-enabled">explicitly disabled</a> to be <span class="css" id="ref-for-disabled-pseudo②">:disabled</span>.</p> <p class="note" role="note"><span class="marker">Note:</span> CSS properties that might affect a user’s ability to interact with a given user interface element do not affect whether it matches <a class="css" data-link-type="maybe" href="#enabled-pseudo" id="ref-for-enabled-pseudo③">:enabled</a> or <a class="css" data-link-type="maybe" href="#disabled-pseudo" id="ref-for-disabled-pseudo③">:disabled</a>; e.g., the <a class="property css" data-link-type="property" href="https://drafts.csswg.org/css-display-3/#propdef-display" id="ref-for-propdef-display①">display</a> and <a class="property css" data-link-type="property" href="https://drafts.csswg.org/css-display-4/#propdef-visibility" id="ref-for-propdef-visibility①">visibility</a> properties have no effect on the enabled/disabled state of an element.</p> <h4 class="heading settled" data-level="13.1.2" id="rw-pseudos"><span class="secno">13.1.2. </span><span class="content"> The Mutability Pseudo-classes: <a class="css" data-link-type="maybe" href="#read-only-pseudo" id="ref-for-read-only-pseudo">:read-only</a> and <a class="css" data-link-type="maybe" href="#read-write-pseudo" id="ref-for-read-write-pseudo">:read-write</a></span><a class="self-link" href="#rw-pseudos"></a></h4> <p>An element matches <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="read-write-pseudo">:read-write</dfn> if it is user-alterable, as defined by the document language. Otherwise, it is <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="read-only-pseudo">:read-only</dfn>.</p> <p>For example, in <a data-link-type="biblio" href="#biblio-html5" title="HTML5">[HTML5]</a> a <a href="https://html.spec.whatwg.org/multipage/semantics-other.html#selector-read-only">non-disabled non-readonly <code><input></code> element</a> is <a class="css" data-link-type="maybe" href="#read-write-pseudo" id="ref-for-read-write-pseudo①">:read-write</a>, as is any element with the <code>contenteditable</code> attribute set to the true state.</p> <h4 class="heading settled" data-level="13.1.3" id="placeholder"><span class="secno">13.1.3. </span><span class="content"> The Placeholder-shown Pseudo-class: <a class="css" data-link-type="maybe" href="#placeholder-shown-pseudo" id="ref-for-placeholder-shown-pseudo">:placeholder-shown</a></span><a class="self-link" href="#placeholder"></a></h4> <p>Input elements can sometimes show placeholder text as a hint to the user on what to type in. See, for example, the <code>placeholder</code> attribute in <a data-link-type="biblio" href="#biblio-html5" title="HTML5">[HTML5]</a>. The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="placeholder-shown-pseudo">:placeholder-shown</dfn> 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.</p> <div class="example" id="example-37912861"><a class="self-link" href="#example-37912861"></a> For example, according to the semantics of <a data-link-type="biblio" href="#biblio-html" title="HTML Standard">[HTML]</a> the <code><a data-link-type="element-sub" href="https://html.spec.whatwg.org/multipage/input.html#attr-input-placeholder" id="ref-for-attr-input-placeholder">placeholder</a></code> attribute on the <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/input.html#the-input-element" id="ref-for-the-input-element②">input</a></code> and <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/form-elements.html#the-textarea-element" id="ref-for-the-textarea-element">textarea</a></code> elements provide placeholder text. The <a class="css" data-link-type="maybe" href="#placeholder-shown-pseudo" id="ref-for-placeholder-shown-pseudo①">:placeholder-shown</a> class thus applies whenever such placeholder text is shown. </div> <h4 class="heading settled" data-level="13.1.4" id="autofill"><span class="secno">13.1.4. </span><span class="content"> The Automatic Input Pseudo-class: <a class="css" data-link-type="maybe" href="#selectordef-autofill" id="ref-for-selectordef-autofill">:autofill</a></span><a class="self-link" href="#autofill"></a></h4> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-autofill">:autofill</dfn> pseudo-class represents input elements that have been automatically filled by the user agent, and have not been subsequently altered by the user.</p> <h4 class="heading settled" data-level="13.1.5" id="the-default-pseudo"><span class="secno">13.1.5. </span><span class="content"> The Default-option Pseudo-class: <a class="css" data-link-type="maybe" href="#default-pseudo" id="ref-for-default-pseudo">:default</a></span><a class="self-link" href="#the-default-pseudo"></a></h4> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="default-pseudo">:default</dfn> 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.</p> <p>One example is the default submit button among a set of buttons. Another example is the default option from a popup menu. In a select-many group (such as for pizza toppings), multiple elements can match <a class="css" data-link-type="maybe" href="#default-pseudo" id="ref-for-default-pseudo①">:default</a>. For example, <a data-link-type="biblio" href="#biblio-html5" title="HTML5">[HTML5]</a> defines that <span class="css" id="ref-for-default-pseudo②">:default</span> matches <a href="https://html.spec.whatwg.org/multipage/semantics-other.html#selector-default">the “default button” in a form, the initially-selected <code><option></code>(s) in a <code><select></code>, and a few other elements.</a></p> <h3 class="heading settled" data-level="13.2" id="input-value-states"><span class="secno">13.2. </span><span class="content"> Input Value States</span><a class="self-link" href="#input-value-states"></a></h3> <h4 class="heading settled" data-level="13.2.1" id="checked"><span class="secno">13.2.1. </span><span class="content"> The Selected-option Pseudo-class: <a class="css" data-link-type="maybe" href="#checked-pseudo" id="ref-for-checked-pseudo">:checked</a></span><a class="self-link" href="#checked"></a></h4> <p>Radio and checkbox elements can be toggled by the user. Some menu items are “checked” when the user selects them. When such elements are toggled “on” the <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="checked-pseudo">:checked</dfn> pseudo-class applies. For example, <a data-link-type="biblio" href="#biblio-html5" title="HTML5">[HTML5]</a> defines that <a href="https://html.spec.whatwg.org/multipage/semantics-other.html#selector-checked">checked checkboxes, radio buttons, and selected <code><option></code> elements</a> match <a class="css" data-link-type="maybe" href="#checked-pseudo" id="ref-for-checked-pseudo①">:checked</a>.</p> <p>While the <a class="css" data-link-type="maybe" href="#checked-pseudo" id="ref-for-checked-pseudo②">:checked</a> pseudo-class is dynamic in nature, and can altered by user action, since it can also be based on the presence of semantic attributes in the document (such as the <code>selected</code> and <code>checked</code> attributes in <a data-link-type="biblio" href="#biblio-html5" title="HTML5">[HTML5]</a>), it applies to all media.</p> <div class="example" id="example-a6c4964c"> <a class="self-link" href="#example-a6c4964c"></a> An unchecked checkbox can be selected by using the negation pseudo-class: <pre>input[type=checkbox]:not(:checked)</pre> </div> <h4 class="heading settled" data-level="13.2.2" id="indeterminate"><span class="secno">13.2.2. </span><span class="content"> The Indeterminate-value Pseudo-class: <a class="css" data-link-type="maybe" href="#indeterminate-pseudo" id="ref-for-indeterminate-pseudo">:indeterminate</a></span><a class="self-link" href="#indeterminate"></a></h4> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="indeterminate-pseudo">:indeterminate</dfn> pseudo-class applies to UI elements whose value is in an indeterminate state. For example, radio and checkbox elements can be toggled between checked and unchecked states, but are sometimes in an indeterminate state, neither checked nor unchecked. Similarly a progress meter can be in an indeterminate state when the percent completion is unknown. For example, <a data-link-type="biblio" href="#biblio-html5" title="HTML5">[HTML5]</a> defines how <a href="https://html.spec.whatwg.org/multipage/semantics-other.html#selector-indeterminate">checkboxes</a> can be made to match <a class="css" data-link-type="maybe" href="#indeterminate-pseudo" id="ref-for-indeterminate-pseudo①">:indeterminate</a>.</p> <p>Like the <a class="css" data-link-type="maybe" href="#checked-pseudo" id="ref-for-checked-pseudo③">:checked</a> pseudo-class, <a class="css" data-link-type="maybe" href="#indeterminate-pseudo" id="ref-for-indeterminate-pseudo②">:indeterminate</a> applies to all media. Components of a radio-group initialized with no pre-selected choice, for example, would be <span class="css" id="ref-for-indeterminate-pseudo③">:indeterminate</span> even in a static display.</p> <h3 class="heading settled" data-level="13.3" id="ui-validity"><span class="secno">13.3. </span><span class="content"> Input Value-checking</span><a class="self-link" href="#ui-validity"></a></h3> <h4 class="heading settled" data-level="13.3.1" id="blank"><span class="secno">13.3.1. </span><span class="content"> The Empty-Value Pseudo-class: <a class="css" data-link-type="maybe" href="#blank-pseudo" id="ref-for-blank-pseudo①">:blank</a></span><a class="self-link" href="#blank"></a></h4> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="blank-pseudo">:blank</dfn> pseudo-class applies to user-input elements whose input value is empty (consists of the empty string or otherwise null input).</p> <div class="note" role="note"> Roughly speaking, if a human looked at a printout of the form and would say it’s blank, it matches <a class="css" data-link-type="maybe" href="#blank-pseudo" id="ref-for-blank-pseudo②">:blank</a>. <p>A rule of thumb for interpreting <a class="css" data-link-type="maybe" href="#blank-pseudo" id="ref-for-blank-pseudo③">:blank</a> on form controls is:</p> <ul> <li data-md> <p>If the control always submits, and would do so with an empty string, it matches <a class="css" data-link-type="maybe" href="#blank-pseudo" id="ref-for-blank-pseudo④">:blank</a>. (Such as HTML’s <code><input type=text></code> when its value is empty.)</p> <li data-md> <p>If it sometimes submits, and is set to not submit, it matches <a class="css" data-link-type="maybe" href="#blank-pseudo" id="ref-for-blank-pseudo⑤">:blank</a>. (Such as HTML’s <code><input type=checkbox></code> when not checked.)</p> <li data-md> <p>If it’s an “action button” (rather than a “toggle button” that represents a state) such as <code><button></code>, <code><input type=submit></code>, etc., it never matches <a class="css" data-link-type="maybe" href="#blank-pseudo" id="ref-for-blank-pseudo⑥">:blank</a>.</p> </ul> <p>Host languages can specify more precise rules for when form controls match <a class="css" data-link-type="maybe" href="#blank-pseudo" id="ref-for-blank-pseudo⑦">:blank</a>.</p> </div> <p class="note" role="note"><span class="marker">Note:</span> This selector is at-risk.</p> <h4 class="heading settled" data-level="13.3.2" id="validity-pseudos"><span class="secno">13.3.2. </span><span class="content"> The Validity Pseudo-classes: <a class="css" data-link-type="maybe" href="#valid-pseudo" id="ref-for-valid-pseudo①">:valid</a> and <a class="css" data-link-type="maybe" href="#invalid-pseudo" id="ref-for-invalid-pseudo">:invalid</a></span><a class="self-link" href="#validity-pseudos"></a></h4> <p>An element is <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="valid-pseudo">:valid</dfn> or <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="invalid-pseudo">:invalid</dfn> when its contents or value is, respectively, valid or invalid with respect to data validity semantics defined by the document language (e.g. <a data-link-type="biblio" href="#biblio-xforms11" title="XForms 1.1">[XFORMS11]</a> or <a data-link-type="biblio" href="#biblio-html5" title="HTML5">[HTML5]</a>). An element which lacks data validity semantics is neither <a class="css" data-link-type="maybe" href="#valid-pseudo" id="ref-for-valid-pseudo②">:valid</a> nor <a class="css" data-link-type="maybe" href="#invalid-pseudo" id="ref-for-invalid-pseudo①">:invalid</a>.</p> <p class="note" role="note"><span class="marker">Note:</span> There is a difference between an element which has no constraints, and thus would always be <a class="css" data-link-type="maybe" href="#valid-pseudo" id="ref-for-valid-pseudo③">:valid</a>, and one which has no data validity semantics at all, and thus is neither <span class="css" id="ref-for-valid-pseudo④">:valid</span> nor <a class="css" data-link-type="maybe" href="#invalid-pseudo" id="ref-for-invalid-pseudo②">:invalid</a>. In HTML, for example, an <code><input type="text"></code> element may have no constraints, but a <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element" id="ref-for-the-p-element②">p</a> element has no validity semantics at all, and so it never matches either of these pseudo-classes.</p> <h4 class="heading settled" data-level="13.3.3" id="range-pseudos"><span class="secno">13.3.3. </span><span class="content"> The Range Pseudo-classes: <a class="css" data-link-type="maybe" href="#in-range-pseudo" id="ref-for-in-range-pseudo">:in-range</a> and <a class="css" data-link-type="maybe" href="#out-of-range-pseudo" id="ref-for-out-of-range-pseudo">:out-of-range</a></span><a class="self-link" href="#range-pseudos"></a></h4> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="in-range-pseudo">:in-range</dfn> and <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="out-of-range-pseudo">:out-of-range</dfn> pseudo-classes apply only to elements that have range limitations. An element is <a class="css" data-link-type="maybe" href="#in-range-pseudo" id="ref-for-in-range-pseudo①">:in-range</a> or <a class="css" data-link-type="maybe" href="#out-of-range-pseudo" id="ref-for-out-of-range-pseudo①">:out-of-range</a> 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 <span class="css" id="ref-for-in-range-pseudo②">:in-range</span> nor <span class="css" id="ref-for-out-of-range-pseudo②">:out-of-range</span>. 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".</p> <h4 class="heading settled" data-level="13.3.4" id="opt-pseudos"><span class="secno">13.3.4. </span><span class="content"> The Optionality Pseudo-classes: <a class="css" data-link-type="maybe" href="#required-pseudo" id="ref-for-required-pseudo">:required</a> and <a class="css" data-link-type="maybe" href="#optional-pseudo" id="ref-for-optional-pseudo">:optional</a></span><a class="self-link" href="#opt-pseudos"></a></h4> <p>A form element is <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="required-pseudo">:required</dfn> or <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="optional-pseudo">:optional</dfn> 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.</p> <h4 class="heading settled" data-level="13.3.5" id="user-pseudos"><span class="secno">13.3.5. </span><span class="content"> The User-interaction Pseudo-classes: <a class="css" data-link-type="maybe" href="#user-valid-pseudo" id="ref-for-user-valid-pseudo">:user-valid</a> and <a class="css" data-link-type="maybe" href="#user-invalid-pseudo" id="ref-for-user-invalid-pseudo">:user-invalid</a></span><a class="self-link" href="#user-pseudos"></a></h4> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="user-invalid-pseudo">:user-invalid</dfn> and the <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="user-valid-pseudo">:user-valid</dfn> pseudo-classes represent an element with incorrect or correct input, respectively, but only <em>after</em> the user has significantly interacted with it. Their purpose is to help the user identify mistakes in their input.</p> <p>These pseudo-classes must at least match their respective elements after the user has attempted to submit the form and before the user has interacted again with the input element or reset the form. They may also match at other times, as would be appropriate for highlighting an error to the user. For example, <a class="css" data-link-type="maybe" href="#user-invalid-pseudo" id="ref-for-user-invalid-pseudo①">:user-invalid</a> could start matching an <a class="css" data-link-type="maybe" href="#invalid-pseudo" id="ref-for-invalid-pseudo③">:invalid</a> input element once the user has changed its value and focus has moved to another element; or stop matching only after the user has successfully corrected the input.</p> <p>Host languages may define more precise matching rules or defer to platform conventions; otherwise the exact behavior is UA-defined. Regardless, the <a class="css" data-link-type="maybe" href="#user-invalid-pseudo" id="ref-for-user-invalid-pseudo②">:user-invalid</a> pseudo-class must only match <a class="css" data-link-type="maybe" href="#invalid-pseudo" id="ref-for-invalid-pseudo④">:invalid</a> elements; and the <a class="css" data-link-type="maybe" href="#user-valid-pseudo" id="ref-for-user-valid-pseudo①">:user-valid</a> pseudo-class must only match <a class="css" data-link-type="maybe" href="#valid-pseudo" id="ref-for-valid-pseudo⑤">:valid</a> elements. See the <a class="css" data-link-type="selector" href="https://html.spec.whatwg.org/multipage/semantics-other.html#selector-user-invalid" id="ref-for-selector-user-invalid">HTML specification</a> for the specific rules pertaining to HTML elements. <a data-link-type="biblio" href="#biblio-html" title="HTML Standard">[HTML]</a></p> <div class="example" id="example-dcf2cbf6"> <a class="self-link" href="#example-dcf2cbf6"></a> For example, the <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/input.html#the-input-element" id="ref-for-the-input-element③">input</a></code> element in the following document fragment would match <a class="css" data-link-type="maybe" href="#invalid-pseudo" id="ref-for-invalid-pseudo⑤">:invalid</a> as soon as the page is loaded (because the <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/input.html#the-input-element" id="ref-for-the-input-element④">input</a></code>'s initial value violates its max constraint) but it won’t match <a class="css" data-link-type="maybe" href="#user-invalid-pseudo" id="ref-for-user-invalid-pseudo③">:user-invalid</a> until the user significantly interacts with the input field or attempts to submit the form it’s part of. <pre><form> <label> Volume: <input name='vol' type=number min=0 max=10 value=11> </label> ... </form> </pre> </div> <h2 class="heading settled" data-level="14" id="structural-pseudos"><span class="secno">14. </span><span class="content"> Tree-Structural pseudo-classes</span><a class="self-link" href="#structural-pseudos"></a></h2> <p>Selectors introduces the concept of <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="structural-pseudo-classes">structural pseudo-classes</dfn> to permit selection based on extra information that lies in the document tree but cannot be represented by other simple selectors or combinators.</p> <p>Standalone text and other non-element nodes are not counted when calculating the position of an element in the list of children of its parent. When calculating the position of an element in the list of children of its parent, the index numbering starts at 1.</p> <p>The <a data-link-type="dfn" href="#structural-pseudo-classes" id="ref-for-structural-pseudo-classes①">structural pseudo-classes</a> only apply to elements in the document tree; they must never match <a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element③⓪">pseudo-elements</a>.</p> <h3 class="heading settled" data-level="14.1" id="the-root-pseudo"><span class="secno">14.1. </span><span class="content"> <a class="css" data-link-type="maybe" href="#root-pseudo" id="ref-for-root-pseudo①">:root</a> pseudo-class</span><a class="self-link" href="#the-root-pseudo"></a></h3> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="root-pseudo">:root</dfn> pseudo-class represents an element that is the root of the document.</p> <p>For example, in a DOM document, the <a class="css" data-link-type="maybe" href="#root-pseudo" id="ref-for-root-pseudo②">:root</a> pseudo-class matches the <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#document-element" id="ref-for-document-element">document element</a>. In HTML, this will be the <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/semantics.html#the-html-element" id="ref-for-the-html-element">html</a></code> element (unless scripting has been used to modify the document).</p> <h3 class="heading settled" data-level="14.2" id="the-empty-pseudo"><span class="secno">14.2. </span><span class="content"> <a class="css" data-link-type="maybe" href="#empty-pseudo" id="ref-for-empty-pseudo">:empty</a> pseudo-class</span><a class="self-link" href="#the-empty-pseudo"></a></h3> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="empty-pseudo">:empty</dfn> pseudo-class represents an element that has no children except, optionally, <a data-link-type="dfn" href="https://drafts.csswg.org/css-text-4/#white-space" id="ref-for-white-space">document white space characters</a>. In terms of the document tree, only element nodes and content nodes (such as <a data-link-type="biblio" href="#biblio-dom" title="DOM Standard">[DOM]</a> 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.</p> <div class="example" id="example-3846287b"> <a class="self-link" href="#example-3846287b"></a> Examples: <span class="css">p:empty</span> is a valid representation of the <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element" id="ref-for-the-p-element③">p</a></code> elements in the following HTML fragment: <pre class="html"><p></p> <p> <p> </p> <p></p> </pre> <p><span class="css">div:empty</span> is not a valid representation of the <code><div></code> elements in the following fragment:</p> <pre class="html"><div>text</div> <div><p></p></div> <div>&nbsp;</div> <div><p>bla</p></div> <div>this is not <p>:empty</p></div> </pre> </div> <p class="note" role="note"><span class="marker">Note:</span> In Level 2 and Level 3 of Selectors, <a class="css" data-link-type="maybe" href="#empty-pseudo" id="ref-for-empty-pseudo①">:empty</a> did not match elements that contained only white space. This was changed so that that—given white space is largely collapsible in HTML and is therefore used for source code formatting, and especially because elements with omitted end tags are likely to absorb such white space into their DOM text contents—elements which authors perceive of as empty can be selected by this selector, as they expect.</p> <h3 class="heading settled" data-level="14.3" id="child-index"><span class="secno">14.3. </span><span class="content"> Child-indexed Pseudo-classes</span><a class="self-link" href="#child-index"></a></h3> <p>The pseudo-classes defined in this section select elements based on their index amongst their <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-tree-inclusive-sibling" id="ref-for-concept-tree-inclusive-sibling">inclusive siblings</a>.</p> <p class="note" role="note"><span class="marker">Note:</span> Selectors 3 described these selectors as selecting elements based on their index in the child list of their parents. (This description survives in the name of this very section, and the names of several of the pseudo-classes.) As there was no reason to exclude them from matching elements without parents, or with non-element parents, they have been rephrased to refer to an element’s relative index amongst its siblings.</p> <h4 class="heading settled" data-level="14.3.1" id="the-nth-child-pseudo"><span class="secno">14.3.1. </span><span class="content"> <a class="css" data-link-type="maybe" href="#nth-child-pseudo" id="ref-for-nth-child-pseudo">:nth-child()</a> pseudo-class</span><a class="self-link" href="#the-nth-child-pseudo"></a></h4> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export data-lt=":nth-child()" id="nth-child-pseudo">:nth-child(<var>An+B</var> [of <var>S</var>]? )</dfn> pseudo-class notation represents elements that are among <var>An+B</var>th elements from the list composed of their <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-tree-inclusive-sibling" id="ref-for-concept-tree-inclusive-sibling①">inclusive siblings</a> that match the <a data-link-type="dfn" href="#selector-list" id="ref-for-selector-list⑧">selector list</a> <var>S</var>, which is a <a class="production css" data-link-type="type" href="#typedef-complex-real-selector-list" id="ref-for-typedef-complex-real-selector-list①"><complex-real-selector-list></a>. If <var>S</var> is omitted, it defaults to <span class="css">*|*</span>.</p> <p>The <var>An+B</var> notation and its interpretation are defined in <a href="https://drafts.csswg.org/css-syntax-3/#anb-microsyntax"><cite>CSS Syntax 3</cite> § 6 The An+B microsyntax</a>; it represents any index <var>i</var> = <var>A</var><var>n</var> + <var>B</var> for any non-negative integer <var>n</var>.</p> <p class="note" role="note"><span class="marker">Note:</span> For these purposes, the list of elements is <b>1-indexed</b>; that is, the first child of an element has index 1, and will be matched by <span class="css">:nth-child(2n+1)</span>, because when <code>n=0</code> the expression evaluates to <span class="css">1</span>.</p> <p>For example, this selector could address every other row in a table, and could be used to alternate the color of paragraph text in a cycle of four.</p> <div class="example" id="example-b8d691c9"> <a class="self-link" href="#example-b8d691c9"></a> Examples: <pre>:nth-child(even) /* represents the 2nd, 4th, 6th, etc elements :nth-child(10n-1) /* represents the 9th, 19th, 29th, etc elements */ :nth-child(10n+9) /* Same */ :nth-child(10n+-1) /* Syntactically invalid, and would be ignored */ </pre> </div> <p class="note" role="note"><span class="marker">Note:</span> The specificity of the <a class="css" data-link-type="maybe" href="#nth-child-pseudo" id="ref-for-nth-child-pseudo①">:nth-child()</a> pseudo-class is the specificity of a single pseudo-class plus, if <var>S</var> is specified, the specificity of the most specific <a data-link-type="dfn" href="#complex" id="ref-for-complex⑤">complex selector</a> in <var>S</var>. See <a href="#specificity-rules">§ 17 Calculating a selector’s specificity</a>. Thus <span class="css"><var>S</var>:nth-child(<var>An+B</var>)</span> and <span class="css">:nth-child(<var>An+B</var> of <var>S</var>)</span> have the exact same specificity, although they do differ in behavior (see example below).</p> <div class="example" id="example-3c07f717"> <a class="self-link" href="#example-3c07f717"></a> By passing a selector argument, we can select the Nth element that matches that selector. For example, the following selector matches the first three “important” list items, denoted by the <span class="css">.important</span> class: <pre>:nth-child(-n+3 of li.important)</pre> <p>Note that this is different from moving the selector outside of the function, like:</p> <pre>li.important:nth-child(-n+3)</pre> <p>This selector instead just selects the first three children if they also happen to be "important" list items.</p> </div> <div class="example" id="example-48f80a26"> <a class="self-link" href="#example-48f80a26"></a> Here’s another example of using the selector argument, to ensure that zebra-striping a table works correctly. <p>Normally, to zebra-stripe a table’s rows, an author would use CSS similar to the following:</p> <pre>tr { background: white; } tr:nth-child(even) { background: silver; } </pre> <p>However, if some of the rows are hidden and not displayed, this can break up the pattern, causing multiple adjacent rows to have the same background color. Assuming that rows are hidden with the <span class="css">[hidden]</span> attribute in HTML, the following CSS would zebra-stripe the table rows robustly, maintaining a proper alternating background regardless of which rows are hidden:</p> <pre>tr { background: white; } tr:nth-child(even of :not([hidden])) { background: silver; } </pre> </div> <h4 class="heading settled" data-level="14.3.2" id="the-nth-last-child-pseudo"><span class="secno">14.3.2. </span><span class="content"> <a class="css" data-link-type="maybe" href="#nth-last-child-pseudo" id="ref-for-nth-last-child-pseudo">:nth-last-child()</a> pseudo-class</span><a class="self-link" href="#the-nth-last-child-pseudo"></a></h4> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export data-lt=":nth-last-child()" id="nth-last-child-pseudo">:nth-last-child(<var>An+B</var> [of <var>S</var>]? )</dfn> pseudo-class notation represents elements that are among <var>An+B</var>th elements from the list composed of their <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-tree-inclusive-sibling" id="ref-for-concept-tree-inclusive-sibling②">inclusive siblings</a> that match the <a data-link-type="dfn" href="#selector-list" id="ref-for-selector-list⑨">selector list</a> <var>S</var>, counting backwards from the end. <var>S</var> is <a class="production css" data-link-type="type" href="#typedef-complex-real-selector-list" id="ref-for-typedef-complex-real-selector-list②"><complex-real-selector-list></a>. If <var>S</var> is omitted, it defaults to <span class="css">*|*</span>.</p> <p class="note" role="note"><span class="marker">Note:</span> The specificity of the <a class="css" data-link-type="maybe" href="#nth-last-child-pseudo" id="ref-for-nth-last-child-pseudo①">:nth-last-child()</a> pseudo-class, like the <a class="css" data-link-type="maybe" href="#nth-child-pseudo" id="ref-for-nth-child-pseudo②">:nth-child()</a> pseudo-class, combines the specificity of a regular pseudo-class with that of its selector argument <var>S</var>. See <a href="#specificity-rules">§ 17 Calculating a selector’s specificity</a>.</p> <p>The CSS Syntax Module <a data-link-type="biblio" href="#biblio-css3syn" title="CSS Syntax Module Level 3">[CSS3SYN]</a> defines the <a href="https://drafts.csswg.org/css-syntax/#anb"><var>An+B</var> notation</a>.</p> <div class="example" id="example-bee68ad4"> <a class="self-link" href="#example-bee68ad4"></a> Examples: <pre>tr:nth-last-child(-n+2) /* represents the two last rows of an HTML table */ foo:nth-last-child(odd) /* represents all odd foo elements in their parent element, counting from the last one */ </pre> </div> <h4 class="heading settled" data-level="14.3.3" id="the-first-child-pseudo"><span class="secno">14.3.3. </span><span class="content"> <a class="css" data-link-type="maybe" href="#first-child-pseudo" id="ref-for-first-child-pseudo">:first-child</a> pseudo-class</span><a class="self-link" href="#the-first-child-pseudo"></a></h4> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="first-child-pseudo">:first-child</dfn> pseudo-class represents an element that if first among its <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-tree-inclusive-sibling" id="ref-for-concept-tree-inclusive-sibling③">inclusive siblings</a>. Same as <span class="css">:nth-child(1)</span>.</p> <div class="example" id="example-72934891"> <a class="self-link" href="#example-72934891"></a> Examples: The following selector represents a <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element" id="ref-for-the-p-element④">p</a> element that is the first child of a <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-div-element" id="ref-for-the-div-element①">div</a> element: <pre>div > p:first-child</pre> <p>This selector can represent the <code>p</code> inside the <code>div</code> of the following fragment:</p> <pre><p> The last P before the note.</p> <div class="note"> <p> The first P inside the note.</p> </div> </pre> <p>but cannot represent the second <code>p</code> in the following fragment:</p> <pre><p> The last P before the note.</p> <div class="note"> <h2> Note </h2> <p> The first P inside the note.</p> </div> </pre> <p>The following two selectors are usually equivalent:</p> <pre>* > a:first-child /* a is first child of any element */ a:first-child /* Same (assuming a is not the root element) */ </pre> </div> <h4 class="heading settled" data-level="14.3.4" id="the-last-child-pseudo"><span class="secno">14.3.4. </span><span class="content"> <a class="css" data-link-type="maybe" href="#last-child-pseudo" id="ref-for-last-child-pseudo">:last-child</a> pseudo-class</span><a class="self-link" href="#the-last-child-pseudo"></a></h4> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="last-child-pseudo">:last-child</dfn> pseudo-class represents an element that is last among its <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-tree-inclusive-sibling" id="ref-for-concept-tree-inclusive-sibling④">inclusive siblings</a>. Same as <span class="css">:nth-last-child(1)</span>.</p> <div class="example" id="example-48137186"> <a class="self-link" href="#example-48137186"></a> Example: The following selector represents a list item <code>li</code> that is the last child of an ordered list <code>ol</code>. <pre>ol > li:last-child</pre> </div> <h4 class="heading settled" data-level="14.3.5" id="the-only-child-pseudo"><span class="secno">14.3.5. </span><span class="content"> <a class="css" data-link-type="maybe" href="#only-child-pseudo" id="ref-for-only-child-pseudo">:only-child</a> pseudo-class</span><a class="self-link" href="#the-only-child-pseudo"></a></h4> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="only-child-pseudo">:only-child</dfn> pseudo-class represents an element that has no siblings. Same as <span class="css">:first-child:last-child</span> or <span class="css">:nth-child(1):nth-last-child(1)</span>, but with a lower specificity.</p> <h3 class="heading settled" data-level="14.4" id="typed-child-index"><span class="secno">14.4. </span><span class="content"> Typed Child-indexed Pseudo-classes</span><a class="self-link" href="#typed-child-index"></a></h3> <p>The pseudo-classes in this section are similar to the <a href="#child-index">Child Index Pseudo-classes</a>, but they resolve based on an element’s index <strong>among elements of the same <a href="#type-selectors">type (tag name)</a></strong> in their sibling list.</p> <h4 class="heading settled" data-level="14.4.1" id="the-nth-of-type-pseudo"><span class="secno">14.4.1. </span><span class="content"> <a class="css" data-link-type="maybe" href="#nth-of-type-pseudo" id="ref-for-nth-of-type-pseudo">:nth-of-type()</a> pseudo-class</span><a class="self-link" href="#the-nth-of-type-pseudo"></a></h4> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export data-lt=":nth-of-type()" id="nth-of-type-pseudo">:nth-of-type(<var>An+B</var>)</dfn> pseudo-class notation represents the same elements that would be matched by <span class="css">:nth-child(|An+B| of <var>S</var>)</span>, where <var>S</var> is a <a data-link-type="dfn" href="#type-selector" id="ref-for-type-selector①②">type selector</a> and namespace prefix matching the element in question. For example, when considering whether an HTML <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element" id="ref-for-the-img-element">img</a></code> element matches this <a data-link-type="dfn" href="#pseudo-class" id="ref-for-pseudo-class②⓪">pseudo-class</a>, the <var>S</var> in question is <span class="css">html|img</span> (assuming an appropriate <code>html</code> namespace is declared).</p> <div class="example" id="example-3d09bf4d"> <a class="self-link" href="#example-3d09bf4d"></a> CSS example: This allows an author to alternate the position of floated images: <pre>img:nth-of-type(2n+1) { float: right; } img:nth-of-type(2n) { float: left; } </pre> </div> <p class="note" role="note"><span class="marker">Note:</span> If the type of the element is known ahead of time, this pseudo-class is equivalent to using <a class="css" data-link-type="maybe" href="#nth-child-pseudo" id="ref-for-nth-child-pseudo③">:nth-child()</a> with a type selector. That is, <span class="css">img:nth-of-type(2)</span> is equivalent to <span class="css">*:nth-child(2 of img)</span>.</p> <h4 class="heading settled" data-level="14.4.2" id="the-nth-last-of-type-pseudo"><span class="secno">14.4.2. </span><span class="content"> <a class="css" data-link-type="maybe" href="#nth-last-of-type-pseudo" id="ref-for-nth-last-of-type-pseudo">:nth-last-of-type()</a> pseudo-class</span><a class="self-link" href="#the-nth-last-of-type-pseudo"></a></h4> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export data-lt=":nth-last-of-type()" id="nth-last-of-type-pseudo">:nth-last-of-type(<var>An+B</var>)</dfn> pseudo-class notation represents the same elements that would be matched by <span class="css">:nth-last-child(|An+B| of <var>S</var>)</span>, where <var>S</var> is a <a data-link-type="dfn" href="#type-selector" id="ref-for-type-selector①③">type selector</a> and namespace prefix matching the element in question. For example, when considering whether an HTML <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element" id="ref-for-the-img-element①">img</a></code> element matches this <a data-link-type="dfn" href="#pseudo-class" id="ref-for-pseudo-class②①">pseudo-class</a>, the <var>S</var> in question is <span class="css">html|img</span> (assuming an appropriate <code>html</code> namespace is declared).</p> <div class="example" id="example-b89418c8"> <a class="self-link" href="#example-b89418c8"></a> Example: To represent all <code>h2</code> children of an XHTML <code>body</code> except the first and last, one could use the following selector: <pre>body > h2:nth-of-type(n+2):nth-last-of-type(n+2) </pre> <p>In this case, one could also use <a class="css" data-link-type="maybe" href="#negation-pseudo" id="ref-for-negation-pseudo⑦">:not()</a>, although the selector ends up being just as long:</p> <pre>body > h2:not(:first-of-type):not(:last-of-type) </pre> </div> <h4 class="heading settled" data-level="14.4.3" id="the-first-of-type-pseudo"><span class="secno">14.4.3. </span><span class="content"> <a class="css" data-link-type="maybe" href="#first-of-type-pseudo" id="ref-for-first-of-type-pseudo">:first-of-type</a> pseudo-class</span><a class="self-link" href="#the-first-of-type-pseudo"></a></h4> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="first-of-type-pseudo">:first-of-type</dfn> pseudo-class represents the same element as <span class="css">:nth-of-type(1)</span>.</p> <div class="example" id="example-16f73753"> <a class="self-link" href="#example-16f73753"></a> Example: The following selector represents a definition title <code>dt</code> inside a definition list <code>dl</code>, this <code>dt</code> being the first of its type in the list of children of its parent element. <pre>dl dt:first-of-type</pre> <p>It is a valid description for the first two <code>dt</code> elements in the following example but not for the third one:</p> <pre><dl> <dt>gigogne</dt> <dd> <dl> <dt>fusée</dt> <dd>multistage rocket</dd> <dt>table</dt> <dd>nest of tables</dd> </dl> </dd> </dl> </pre> </div> <h4 class="heading settled" data-level="14.4.4" id="the-last-of-type-pseudo"><span class="secno">14.4.4. </span><span class="content"> <a class="css" data-link-type="maybe" href="#last-of-type-pseudo" id="ref-for-last-of-type-pseudo">:last-of-type</a> pseudo-class</span><a class="self-link" href="#the-last-of-type-pseudo"></a></h4> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="last-of-type-pseudo">:last-of-type</dfn> pseudo-class represents the same element as <span class="css">:nth-last-of-type(1)</span>.</p> <div class="example" id="example-fee30007"> <a class="self-link" href="#example-fee30007"></a> Example: The following selector represents the last data cell <code>td</code> of a table row <code>tr</code>. <pre>tr > td:last-of-type</pre> </div> <h4 class="heading settled" data-level="14.4.5" id="the-only-of-type-pseudo"><span class="secno">14.4.5. </span><span class="content"> <a class="css" data-link-type="maybe" href="#only-of-type-pseudo" id="ref-for-only-of-type-pseudo">:only-of-type</a> pseudo-class</span><a class="self-link" href="#the-only-of-type-pseudo"></a></h4> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="only-of-type-pseudo">:only-of-type</dfn> pseudo-class represents the same element as <span class="css">:first-of-type:last-of-type</span>.</p> <h2 class="heading settled" data-level="15" id="combinators"><span class="secno">15. </span><span class="content"> Combinators</span><a class="self-link" href="#combinators"></a></h2> <h3 class="heading settled" data-level="15.1" id="descendant-combinators"><span class="secno">15.1. </span><span class="content"> Descendant combinator (<code> </code>)</span><a class="self-link" href="#descendant-combinators"></a></h3> <p>At times, authors may want selectors to describe an element that is the descendant of another element in the document tree (e.g., "an <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-em-element" id="ref-for-the-em-element">em</a> element that is contained within an <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/sections.html#the-h1-element" id="ref-for-the-h1-element⑥">H1</a> element"). The <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="descendant-combinator">descendant combinator</dfn> expresses such a relationship.</p> <p>A descendant combinator is whitespace that separates two <a data-link-type="dfn" href="#compound" id="ref-for-compound③⑦">compound selectors</a>.</p> <p>A selector of the form <span class="css">A B</span> represents an element <code>B</code> that is an arbitrary descendant of some ancestor element <code>A</code>.</p> <div class="example" id="example-13246ba1"> <a class="self-link" href="#example-13246ba1"></a> Examples: For example, consider the following selector: <pre>h1 em</pre> <p>It represents an <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-em-element" id="ref-for-the-em-element①">em</a> element being the descendant of an <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/sections.html#the-h1-element" id="ref-for-the-h1-element⑦">h1</a> element. It is a correct and valid, but partial, description of the following fragment:</p> <pre><h1>This <span class="myclass">headline is <em>very</em> important</span></h1> </pre> <p>The following selector:</p> <pre>div * p</pre> <p>represents a <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element" id="ref-for-the-p-element⑤">p</a> element that is a grandchild or later descendant of a <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-div-element" id="ref-for-the-div-element②">div</a> element. Note the whitespace on either side of the "*" is not part of the universal selector; the whitespace is a combinator indicating that the <code>div</code> must be the ancestor of some element, and that that element must be an ancestor of the <code>p</code>. The following selector, which combines descendant combinators and <a href="#attribute-selectors">attribute selectors</a>, represents an element that (1) has the <code>href</code> attribute set and (2) is inside a <code>p</code> that is itself inside a <code>div</code>:</p> <pre>div p *[href]</pre> </div> <h3 class="heading settled" data-level="15.2" id="child-combinators"><span class="secno">15.2. </span><span class="content"> Child combinator (<code>></code>)</span><a class="self-link" href="#child-combinators"></a></h3> <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="child-combinator">child combinator</dfn> describes a childhood relationship between two elements. A child combinator is made of the "greater-than sign" (U+003E, <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-child">></dfn>) code point and separates two <a data-link-type="dfn" href="#compound" id="ref-for-compound③⑧">compound selectors</a>.</p> <div class="example" id="example-63e612ba"> <a class="self-link" href="#example-63e612ba"></a> Examples: The following selector represents a <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element" id="ref-for-the-p-element⑥">p</a> element that is child of <code>body</code>: <pre>body > p</pre> <p>The following example combines descendant combinators and child combinators.</p> <pre>div ol>li p</pre> <p>It represents a <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element" id="ref-for-the-p-element⑦">p</a> element that is a descendant of an <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-li-element" id="ref-for-the-li-element">li</a> element; the <span id="ref-for-the-li-element①">li</span> element must be the child of an <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-ol-element" id="ref-for-the-ol-element①">ol</a> element; the <span id="ref-for-the-ol-element②">ol</span> element must be a descendant of a <code>div</code>. Notice that the optional white space around the ">" combinator has been left out.</p> </div> <p>For information on selecting the first child of an element, please see the section on the <a class="css" data-link-type="maybe" href="#first-child-pseudo" id="ref-for-first-child-pseudo①">:first-child</a> pseudo-class above.</p> <h3 class="heading settled" data-level="15.3" id="adjacent-sibling-combinators"><span class="secno">15.3. </span><span class="content"> Next-sibling combinator (<code>+</code>)</span><a class="self-link" href="#adjacent-sibling-combinators"></a></h3> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="next-sibling-combinator">next-sibling combinator</dfn> is made of the “plus sign” (U+002B, <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-adjacent">+</dfn>) code point that separates two <a data-link-type="dfn" href="#compound" id="ref-for-compound③⑨">compound selectors</a>. The elements represented by the two <span id="ref-for-compound④⓪">compound selectors</span> share the same parent in the document tree and the element represented by the first <span id="ref-for-compound④①">compound selector</span> 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.</p> <div class="example" id="example-0f0597d9"> <a class="self-link" href="#example-0f0597d9"></a> Examples: The following selector represents a <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element" id="ref-for-the-p-element⑧">p</a> element immediately following a <a data-link-type="element" href="https://w3c.github.io/mathml-core/#dfn-math" id="ref-for-dfn-math">math</a> element: <pre>math + p</pre> <p>The following selector is conceptually similar to the one in the previous example, except that it adds an attribute selector — it adds a constraint to the <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/sections.html#the-h1-element" id="ref-for-the-h1-element⑧">h1</a> element, that it must have <code>class="opener"</code>:</p> <pre>h1.opener + h2</pre> </div> <h3 class="heading settled" data-level="15.4" id="general-sibling-combinators"><span class="secno">15.4. </span><span class="content"> Subsequent-sibling combinator (<code>~</code>)</span><a class="self-link" href="#general-sibling-combinators"></a></h3> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="subsequent-sibling-combinator">subsequent-sibling combinator</dfn> is made of the "tilde" (U+007E, <dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-sibling">~</dfn>) code point that separates two <a data-link-type="dfn" href="#compound" id="ref-for-compound④②">compound selectors</a>. The elements represented by the two <span id="ref-for-compound④③">compound selectors</span> 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.</p> <div class="example" id="example-ae614b62"> <a class="self-link" href="#example-ae614b62"></a> <pre>h1 ~ pre</pre> <p>represents a <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-pre-element" id="ref-for-the-pre-element">pre</a> element following an <code>h1</code>. It is a correct and valid, but partial, description of:</p> <pre><h1>Definition of the function a</h1> <p>Function a(x) has to be applied to all figures in the table.</p> <pre>function a(x) = 12x/13.5</pre> </pre> </div> <h2 class="heading settled" data-level="16" id="table-pseudos"><span class="secno">16. </span><span class="content"> Grid-Structural Selectors</span><a class="self-link" href="#table-pseudos"></a></h2> <p>The double-association of a cell in a 2D grid (to its row and column) cannot be represented by parentage in a hierarchical markup language. Only one of those associations can be represented hierarchically: the other must be explicitly or implicitly defined in the document language semantics. In both HTML and DocBook, two of the most common hierarchical markup languages, the markup is row-primary (that is, the row associations are represented hierarchically); the columns must be implied. To be able to represent such implied column-based relationships, the <a data-link-type="dfn" href="#column-combinator" id="ref-for-column-combinator">column combinator</a> and the <a class="css" data-link-type="maybe" href="#nth-col-pseudo" id="ref-for-nth-col-pseudo">:nth-col()</a> and <a class="css" data-link-type="maybe" href="#nth-last-col-pseudo" id="ref-for-nth-last-col-pseudo">:nth-last-col()</a> pseudo-classes are defined. In a column-primary format, these pseudo-classes match against row associations instead.</p> <h3 class="heading settled" data-level="16.1" id="the-column-combinator"><span class="secno">16.1. </span><span class="content"> Column combinator (<code>||</code>)</span><a class="self-link" href="#the-column-combinator"></a></h3> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="column-combinator">column combinator</dfn>, which consists of two pipes (<dfn class="dfn-paneled css" data-dfn-type="selector" data-export id="selectordef-column">||</dfn>) 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.</p> <div class="example" id="example-60f47339"> <a class="self-link" href="#example-60f47339"></a> The following example makes cells C, E, and G gray. <pre>col.selected || td { background: gray; color: white; font-weight: bold; } </pre> <pre><table> <col span="2"> <col class="selected"> <tr><td>A <td>B <td>C <tr><td colspan="2">D <td>E <tr><td>F <td colspan="2">G </table> </pre> </div> <h3 class="heading settled" data-level="16.2" id="the-nth-col-pseudo"><span class="secno">16.2. </span><span class="content"> <a class="css" data-link-type="maybe" href="#nth-col-pseudo" id="ref-for-nth-col-pseudo①">:nth-col()</a> pseudo-class</span><a class="self-link" href="#the-nth-col-pseudo"></a></h3> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export data-lt=":nth-col()" id="nth-col-pseudo">:nth-col(<var>An+B</var>)</dfn> pseudo-class notation represents a cell element belonging to a column that has <var>An+B</var>-1 columns <strong>before</strong> it, for any positive integer or zero value of <code>n</code>. 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 any of those columns.</p> <p>The CSS Syntax Module <a data-link-type="biblio" href="#biblio-css3syn" title="CSS Syntax Module Level 3">[CSS3SYN]</a> defines the <a href="https://drafts.csswg.org/css-syntax/#anb"><var>An+B</var> notation</a>.</p> <h3 class="heading settled" data-level="16.3" id="the-nth-last-col-pseudo"><span class="secno">16.3. </span><span class="content"> <a class="css" data-link-type="maybe" href="#nth-last-col-pseudo" id="ref-for-nth-last-col-pseudo①">:nth-last-col()</a> pseudo-class</span><a class="self-link" href="#the-nth-last-col-pseudo"></a></h3> <p>The <dfn class="dfn-paneled css" data-dfn-type="selector" data-export data-lt=":nth-last-col()" id="nth-last-col-pseudo">:nth-last-col(<var>An+B</var>)</dfn> pseudo-class notation represents a cell element belonging to a column that has <var>An+B</var>-1 columns <strong>after</strong> it, for any positive integer or zero value of <code>n</code>. 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 any of those columns.</p> <p>The CSS Syntax Module <a data-link-type="biblio" href="#biblio-css3syn" title="CSS Syntax Module Level 3">[CSS3SYN]</a> defines the <a href="https://drafts.csswg.org/css-syntax/#anb"><var>An+B</var> notation</a>.</p> <h2 class="heading settled" data-level="17" id="specificity-rules"><span class="secno">17. </span><span class="content"> Calculating a selector’s specificity</span><a class="self-link" href="#specificity-rules"></a></h2> <p>A selector’s <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="specificity">specificity</dfn> is calculated for a given element as follows:</p> <ul> <li>count the number of ID selectors in the selector (= <var>A</var>) <li>count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= <var>B</var>) <li>count the number of type selectors and pseudo-elements in the selector (= <var>C</var>) <li>ignore the universal selector </ul> <p>If the selector is a <a data-link-type="dfn" href="#selector-list" id="ref-for-selector-list①⓪">selector list</a>, this number is calculated for each selector in the list. For a given matching process against the list, the specificity in effect is that of the most specific selector in the list that matches.</p> <p>A few pseudo-classes provide “evaluation contexts” for other selectors, and so have their specificity defined specially:</p> <ul> <li> The specificity of an <a class="css" data-link-type="maybe" href="#matches-pseudo" id="ref-for-matches-pseudo①⑦">:is()</a>, <a class="css" data-link-type="maybe" href="#negation-pseudo" id="ref-for-negation-pseudo⑧">:not()</a>, or <a class="css" data-link-type="maybe" href="#has-pseudo" id="ref-for-has-pseudo①①">:has()</a> pseudo-class is replaced by the specificity of the most specific <a data-link-type="dfn" href="#complex" id="ref-for-complex⑥">complex selector</a> in its <a data-link-type="dfn" href="#selector-list" id="ref-for-selector-list①①">selector list</a> argument. <li> Analogously, the specificity of an <a class="css" data-link-type="maybe" href="#nth-child-pseudo" id="ref-for-nth-child-pseudo④">:nth-child()</a> or <a class="css" data-link-type="maybe" href="#nth-last-child-pseudo" id="ref-for-nth-last-child-pseudo②">:nth-last-child()</a> selector is the specificity of the pseudo-class itself (counting as one pseudo-class selector) plus the specificity of the most specific <a data-link-type="dfn" href="#complex" id="ref-for-complex⑦">complex selector</a> in its <a data-link-type="dfn" href="#selector-list" id="ref-for-selector-list①②">selector list</a> argument (if any). <li> The specificity of a <a class="css" data-link-type="maybe" href="#where-pseudo" id="ref-for-where-pseudo⑤">:where()</a> pseudo-class is replaced by zero. </ul> <div class="example" id="example-66faea1b"> <a class="self-link" href="#example-66faea1b"></a> For example: <ul> <li> <span class="css">:is(em, #foo)</span> has a specificity of (1,0,0)—like an ID selector (<span class="css">#foo</span>)—when matched against any of <code><em></code>, <code><p id=foo></code>, or <code><em id=foo></code>. <li> <span class="css">.qux:where(em, #foo#bar#baz)</span> has a specificity of (0,1,0): only the <span class="css">.qux</span> outside the <a class="css" data-link-type="maybe" href="#where-pseudo" id="ref-for-where-pseudo⑥">:where()</a> contributes to selector specificity. <li> <span class="css">:nth-child(even of li, .item)</span> has a specificity of (0,2,0)—like a class selector (<span class="css">.item</span>) plus a pseudo-class—when matched against any of <code><li></code>, <code><ul class=item></code>, or <code><li class=item id=foo></code>. <li> <span class="css">:not(em, strong#foo)</span> has a specificity of (1,0,1)—like a tag selector (<span class="css">strong</span>) combined with an ID selector (<span class="css">#foo</span>)—when matched against any element. </ul> </div> <p>Specificities are compared by comparing the three components in order: the specificity with a larger <var>A</var> value is more specific; if the two <var>A</var> values are tied, then the specificity with a larger <var>B</var> value is more specific; if the two <var>B</var> values are also tied, then the specificity with a larger <var>C</var> value is more specific; if all the values are tied, the two specificities are equal.</p> <p>Due to storage limitations, implementations may have limitations on the size of <var>A</var>, <var>B</var>, or <var>C</var>. If so, values higher than the limit must be clamped to that limit, and not overflow.</p> <div class="example" id="example-d97bd125"> <a class="self-link" href="#example-d97bd125"></a> Examples: <pre>* /* a=0 b=0 c=0 */ LI /* a=0 b=0 c=1 */ UL LI /* a=0 b=0 c=2 */ UL OL+LI /* a=0 b=0 c=3 */ H1 + *[REL=up] /* a=0 b=1 c=1 */ UL OL LI.red /* a=0 b=1 c=3 */ LI.red.level /* a=0 b=2 c=1 */ #x34y /* a=1 b=0 c=0 */ #s12:not(FOO) /* a=1 b=0 c=1 */ .foo :is(.bar, #baz) /* a=1 b=1 c=0 */ </pre> </div> <p class="note" role="note"><span class="marker">Note:</span> Repeated occurrences of the same simple selector are allowed and do increase specificity.</p> <p class="note" role="note"><span class="marker">Note:</span> The specificity of the styles specified in an HTML <code>style</code> attribute <a href="https://www.w3.org/TR/css-style-attr/#interpret">is described in CSS Style Attributes</a>. <a data-link-type="biblio" href="#biblio-cssstyleattr" title="CSS Style Attributes">[CSSSTYLEATTR]</a></p> <h2 class="heading settled" data-level="18" id="grammar"><span class="secno">18. </span><span class="content"> Grammar</span><span id="formal-syntax"></span><a class="self-link" href="#grammar"></a></h2> <p>Selectors are <a data-link-type="dfn" href="https://drafts.csswg.org/css-syntax-3/#css-parse-something-according-to-a-css-grammar" id="ref-for-css-parse-something-according-to-a-css-grammar">parsed</a> according to the following grammar:</p> <pre class="prod"><dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-selector-list"><selector-list></dfn> = <a class="production" data-link-type="type" href="#typedef-complex-selector-list" id="ref-for-typedef-complex-selector-list"><complex-selector-list></a> <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-complex-selector-list"><complex-selector-list></dfn> = <a class="production" data-link-type="type" href="#typedef-complex-selector" id="ref-for-typedef-complex-selector①"><complex-selector></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-comma" id="ref-for-mult-comma">#</a> <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-complex-real-selector-list"><complex-real-selector-list></dfn> = <a class="production" data-link-type="type" href="#typedef-complex-real-selector" id="ref-for-typedef-complex-real-selector"><complex-real-selector></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-comma" id="ref-for-mult-comma①">#</a> <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-compound-selector-list"><compound-selector-list></dfn> = <a class="production" data-link-type="type" href="#typedef-compound-selector" id="ref-for-typedef-compound-selector①"><compound-selector></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-comma" id="ref-for-mult-comma②">#</a> <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-simple-selector-list"><simple-selector-list></dfn> = <a class="production" data-link-type="type" href="#typedef-simple-selector" id="ref-for-typedef-simple-selector①"><simple-selector></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-comma" id="ref-for-mult-comma③">#</a> <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-relative-selector-list"><relative-selector-list></dfn> = <a class="production" data-link-type="type" href="#typedef-relative-selector" id="ref-for-typedef-relative-selector①"><relative-selector></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-comma" id="ref-for-mult-comma④">#</a> <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-relative-real-selector-list"><relative-real-selector-list></dfn> = <a class="production" data-link-type="type" href="#typedef-relative-real-selector" id="ref-for-typedef-relative-real-selector"><relative-real-selector></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-comma" id="ref-for-mult-comma⑤">#</a> <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-complex-selector"><complex-selector></dfn> = <a class="production" data-link-type="type" href="#typedef-complex-selector-unit" id="ref-for-typedef-complex-selector-unit"><complex-selector-unit></a> [ <a class="production" data-link-type="type" href="#typedef-combinator" id="ref-for-typedef-combinator"><combinator></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-opt" id="ref-for-mult-opt">?</a> <a class="production" data-link-type="type" href="#typedef-complex-selector-unit" id="ref-for-typedef-complex-selector-unit①"><complex-selector-unit></a> ]<a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-zero-plus" id="ref-for-mult-zero-plus">*</a> <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-complex-selector-unit"><complex-selector-unit></dfn> = [ <a class="production" data-link-type="type" href="#typedef-compound-selector" id="ref-for-typedef-compound-selector②"><compound-selector></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-opt" id="ref-for-mult-opt①">?</a> <a class="production" data-link-type="type" href="#typedef-pseudo-compound-selector" id="ref-for-typedef-pseudo-compound-selector①"><pseudo-compound-selector></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-zero-plus" id="ref-for-mult-zero-plus①">*</a> ]<a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-req" id="ref-for-mult-req">!</a> <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-complex-real-selector"><complex-real-selector></dfn> = <a class="production" data-link-type="type" href="#typedef-compound-selector" id="ref-for-typedef-compound-selector③"><compound-selector></a> [ <a class="production" data-link-type="type" href="#typedef-combinator" id="ref-for-typedef-combinator①"><combinator></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-opt" id="ref-for-mult-opt②">?</a> <a class="production" data-link-type="type" href="#typedef-compound-selector" id="ref-for-typedef-compound-selector④"><compound-selector></a> ]<a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-zero-plus" id="ref-for-mult-zero-plus②">*</a> <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-relative-selector"><relative-selector></dfn> = <a class="production" data-link-type="type" href="#typedef-combinator" id="ref-for-typedef-combinator②"><combinator></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-opt" id="ref-for-mult-opt③">?</a> <a class="production" data-link-type="type" href="#typedef-complex-selector" id="ref-for-typedef-complex-selector②"><complex-selector></a> <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-relative-real-selector"><relative-real-selector></dfn> = <a class="production" data-link-type="type" href="#typedef-combinator" id="ref-for-typedef-combinator③"><combinator></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-opt" id="ref-for-mult-opt④">?</a> <a class="production" data-link-type="type" href="#typedef-complex-real-selector" id="ref-for-typedef-complex-real-selector①"><complex-real-selector></a> <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-compound-selector"><compound-selector></dfn> = [ <a class="production" data-link-type="type" href="#typedef-type-selector" id="ref-for-typedef-type-selector"><type-selector></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-opt" id="ref-for-mult-opt⑤">?</a> <a class="production" data-link-type="type" href="#typedef-subclass-selector" id="ref-for-typedef-subclass-selector"><subclass-selector></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-zero-plus" id="ref-for-mult-zero-plus③">*</a> ]<a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-req" id="ref-for-mult-req①">!</a> <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-pseudo-compound-selector"><pseudo-compound-selector></dfn> = <a class="production" data-link-type="type" href="#typedef-pseudo-element-selector" id="ref-for-typedef-pseudo-element-selector"><pseudo-element-selector></a> <a class="production" data-link-type="type" href="#typedef-pseudo-class-selector" id="ref-for-typedef-pseudo-class-selector"><pseudo-class-selector></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-zero-plus" id="ref-for-mult-zero-plus④">*</a> <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-simple-selector"><simple-selector></dfn> = <a class="production" data-link-type="type" href="#typedef-type-selector" id="ref-for-typedef-type-selector①"><type-selector></a> <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one">|</a> <a class="production" data-link-type="type" href="#typedef-subclass-selector" id="ref-for-typedef-subclass-selector①"><subclass-selector></a> <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-combinator"><combinator></dfn> = '>' <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one①">|</a> '+' <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one②">|</a> '~' <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one③">|</a> [ '|' '|' ] <dfn class="dfn-paneled" data-dfn-type="type" data-noexport id="typedef-wq-name"><wq-name></dfn> = <a class="production" data-link-type="type" href="#typedef-ns-prefix" id="ref-for-typedef-ns-prefix"><ns-prefix></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-opt" id="ref-for-mult-opt⑥">?</a> <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-syntax-3/#typedef-ident-token" id="ref-for-typedef-ident-token②"><ident-token></a> <dfn class="dfn-paneled" data-dfn-type="type" data-noexport id="typedef-ns-prefix"><ns-prefix></dfn> = [ <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-syntax-3/#typedef-ident-token" id="ref-for-typedef-ident-token③"><ident-token></a> <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one④">|</a> '*' ]<a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-opt" id="ref-for-mult-opt⑦">?</a> '|' <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-type-selector"><type-selector></dfn> = <a class="production" data-link-type="type" href="#typedef-wq-name" id="ref-for-typedef-wq-name"><wq-name></a> <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one⑤">|</a> <a class="production" data-link-type="type" href="#typedef-ns-prefix" id="ref-for-typedef-ns-prefix①"><ns-prefix></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-opt" id="ref-for-mult-opt⑧">?</a> '*' <dfn class="dfn-paneled" data-dfn-type="type" data-noexport id="typedef-subclass-selector"><subclass-selector></dfn> = <a class="production" data-link-type="type" href="#typedef-id-selector" id="ref-for-typedef-id-selector"><id-selector></a> <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one⑥">|</a> <a class="production" data-link-type="type" href="#typedef-class-selector" id="ref-for-typedef-class-selector"><class-selector></a> <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one⑦">|</a> <a class="production" data-link-type="type" href="#typedef-attribute-selector" id="ref-for-typedef-attribute-selector"><attribute-selector></a> <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one⑧">|</a> <a class="production" data-link-type="type" href="#typedef-pseudo-class-selector" id="ref-for-typedef-pseudo-class-selector①"><pseudo-class-selector></a> <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-id-selector"><id-selector></dfn> = <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-syntax-3/#typedef-hash-token" id="ref-for-typedef-hash-token"><hash-token></a> <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-class-selector"><class-selector></dfn> = '.' <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-syntax-3/#typedef-ident-token" id="ref-for-typedef-ident-token④"><ident-token></a> <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-attribute-selector"><attribute-selector></dfn> = '[' <a class="production" data-link-type="type" href="#typedef-wq-name" id="ref-for-typedef-wq-name①"><wq-name></a> ']' <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one⑨">|</a> '[' <a class="production" data-link-type="type" href="#typedef-wq-name" id="ref-for-typedef-wq-name②"><wq-name></a> <a class="production" data-link-type="type" href="#typedef-attr-matcher" id="ref-for-typedef-attr-matcher"><attr-matcher></a> [ <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-syntax-3/#typedef-string-token" id="ref-for-typedef-string-token②"><string-token></a> <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one①⓪">|</a> <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-syntax-3/#typedef-ident-token" id="ref-for-typedef-ident-token⑤"><ident-token></a> ] <a class="production" data-link-type="type" href="#typedef-attr-modifier" id="ref-for-typedef-attr-modifier"><attr-modifier></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-opt" id="ref-for-mult-opt⑨">?</a> ']' <dfn class="dfn-paneled" data-dfn-type="type" data-noexport id="typedef-attr-matcher"><attr-matcher></dfn> = [ '~' <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one①①">|</a> '|' <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one①②">|</a> '^' <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one①③">|</a> '$' <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one①④">|</a> '*' ]<a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-opt" id="ref-for-mult-opt①⓪">?</a> '=' <dfn class="dfn-paneled" data-dfn-type="type" data-noexport id="typedef-attr-modifier"><attr-modifier></dfn> = i <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one①⑤">|</a> s <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-pseudo-class-selector"><pseudo-class-selector></dfn> = ':' <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-syntax-3/#typedef-ident-token" id="ref-for-typedef-ident-token⑥"><ident-token></a> <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one①⑥">|</a> ':' <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-syntax-3/#typedef-function-token" id="ref-for-typedef-function-token"><function-token></a> <a class="production" data-link-type="type" href="https://drafts.csswg.org/css-syntax-3/#typedef-any-value" id="ref-for-typedef-any-value"><any-value></a> ')' <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-pseudo-element-selector"><pseudo-element-selector></dfn> = ':' <a class="production" data-link-type="type" href="#typedef-pseudo-class-selector" id="ref-for-typedef-pseudo-class-selector②"><pseudo-class-selector></a> <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one①⑦">|</a> <a class="production" data-link-type="type" href="#typedef-legacy-pseudo-element-selector" id="ref-for-typedef-legacy-pseudo-element-selector"><legacy-pseudo-element-selector></a> <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-legacy-pseudo-element-selector"><legacy-pseudo-element-selector></dfn> = ':' [before <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one①⑧">|</a> after <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one①⑨">|</a> first-line <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one②⓪">|</a> first-letter] </pre> <p>In interpreting the above grammar, the following rules apply:</p> <ul> <li id="white-space"> <a class="self-link" href="#white-space"></a> White space is forbidden: <ul> <li data-md> <p>Between any of the top-level components of a <a class="production css" data-link-type="type" href="#typedef-compound-selector" id="ref-for-typedef-compound-selector⑤"><compound-selector></a> or <a class="production css" data-link-type="type" href="#typedef-complex-selector-unit" id="ref-for-typedef-complex-selector-unit②"><complex-selector-unit></a> (that is, forbidden between the <a class="production css" data-link-type="type" href="#typedef-type-selector" id="ref-for-typedef-type-selector②"><type-selector></a> and <a class="production css" data-link-type="type" href="#typedef-subclass-selector" id="ref-for-typedef-subclass-selector②"><subclass-selector></a>, or between the <a class="production css" data-link-type="type" href="#typedef-pseudo-element-selector" id="ref-for-typedef-pseudo-element-selector①"><pseudo-element-selector></a> and <a class="production css" data-link-type="type" href="#typedef-pseudo-class-selector" id="ref-for-typedef-pseudo-class-selector③"><pseudo-class-selector></a>, etc).</p> <li data-md> <p>Between <em>any</em> of the components of a <a class="production css" data-link-type="type" href="#typedef-type-selector" id="ref-for-typedef-type-selector③"><type-selector></a> or a <a class="production css" data-link-type="type" href="#typedef-class-selector" id="ref-for-typedef-class-selector①"><class-selector></a>.</p> <li data-md> <p>Between the ':'s, or between the ':' and <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-syntax-3/#typedef-ident-token" id="ref-for-typedef-ident-token⑦"><ident-token></a> or <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-syntax-3/#typedef-function-token" id="ref-for-typedef-function-token①"><function-token></a>, of a <a class="production css" data-link-type="type" href="#typedef-pseudo-element-selector" id="ref-for-typedef-pseudo-element-selector②"><pseudo-element-selector></a> or a <a class="production css" data-link-type="type" href="#typedef-pseudo-class-selector" id="ref-for-typedef-pseudo-class-selector④"><pseudo-class-selector></a>.</p> <li data-md> <p>Between <em>any</em> of the components of a <a class="production css" data-link-type="type" href="#typedef-wq-name" id="ref-for-typedef-wq-name③"><wq-name></a>.</p> <li data-md> <p>Between the components of an <a class="production css" data-link-type="type" href="#typedef-attr-matcher" id="ref-for-typedef-attr-matcher①"><attr-matcher></a>.</p> <li data-md> <p>Between the <a class="production css" data-link-type="type" href="#typedef-compound-selector" id="ref-for-typedef-compound-selector⑥"><compound-selector></a> or <a class="production css" data-link-type="type" href="#typedef-pseudo-compound-selector" id="ref-for-typedef-pseudo-compound-selector②"><pseudo-compound-selector></a>s in a <a class="production css" data-link-type="type" href="#typedef-complex-selector-unit" id="ref-for-typedef-complex-selector-unit③"><complex-selector-unit></a></p> <li data-md> <p>Between the components of a <a class="production css" data-link-type="type" href="#typedef-combinator" id="ref-for-typedef-combinator④"><combinator></a>.</p> </ul> <p>Whitespace is <em>required</em> between two <a class="production css" data-link-type="type" href="#typedef-complex-selector-unit" id="ref-for-typedef-complex-selector-unit④"><complex-selector-unit></a>s if the <a class="production css" data-link-type="type" href="#typedef-combinator" id="ref-for-typedef-combinator⑤"><combinator></a> between them is omitted. (This indicates the descendant combinator is being used.)</p> <li> In <a class="production css" data-link-type="type" href="#typedef-id-selector" id="ref-for-typedef-id-selector①"><id-selector></a>, the <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-syntax-3/#typedef-hash-token" id="ref-for-typedef-hash-token①"><hash-token></a>’s value must be an <a data-link-type="dfn" href="https://drafts.csswg.org/css-values-4/#css-css-identifier" id="ref-for-css-css-identifier③">identifier</a>. <li> The <a class="production css" data-link-type="type" href="#typedef-pseudo-class-selector" id="ref-for-typedef-pseudo-class-selector⑤"><pseudo-class-selector></a> production excludes the <a class="production css" data-link-type="type" href="#typedef-legacy-pseudo-element-selector" id="ref-for-typedef-legacy-pseudo-element-selector①"><legacy-pseudo-element-selector></a> production. (That is, <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css2/#selectordef-before" id="ref-for-selectordef-before⑥">:before</a>/etc must never be parsed as a pseudo-class, even if doing so would cause the selector to become valid due to, for example, other simple selectors following it.) </ul> <p class="note" role="note"><span class="marker">Note:</span> A selector is also subject to a variety of more specific syntactic constraints, and adherence to the grammar above is necessary <em>but not sufficient</em> for the selector to be considered valid. See <a href="#invalid">§ 3.9 Invalid Selectors and Error Handling</a> for additional rules for parsing selectors.</p> <p class="note" role="note"><span class="marker">Note:</span> In general, a <a class="production css" data-link-type="type" href="#typedef-pseudo-element-selector" id="ref-for-typedef-pseudo-element-selector③"><pseudo-element-selector></a> is only valid if placed at the end of the last <a class="production css" data-link-type="type" href="#typedef-compound-selector" id="ref-for-typedef-compound-selector⑦"><compound-selector></a> in a <a class="production css" data-link-type="type" href="#typedef-complex-selector" id="ref-for-typedef-complex-selector③"><complex-selector></a>. In some circumstances, however, it can be followed by more <span class="production" id="ref-for-typedef-pseudo-element-selector④"><pseudo-element-selector></span>s or <a class="production css" data-link-type="type" href="#typedef-pseudo-class-selector" id="ref-for-typedef-pseudo-class-selector⑥"><pseudo-class-selector></a>s; but these are specified on a case-by-case basis. (For example, the <a data-link-type="dfn" href="#user-action-pseudo-class" id="ref-for-user-action-pseudo-class②">user action pseudo-classes</a> are allowed after any <a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element③①">pseudo-element</a>, and the <a data-link-type="dfn" href="https://drafts.csswg.org/css-pseudo-4/#tree-abiding" id="ref-for-tree-abiding①">tree-abiding pseudo-elements</a> are allowed after the <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-scoping-1/#selectordef-slotted" id="ref-for-selectordef-slotted">::slotted()</a> pseudo-element.)</p> <p class="note" id="single-colon-pseudos" role="note"><a class="self-link" href="#single-colon-pseudos"></a> The four <a href="https://www.w3.org/TR/CSS2/selectors.html#pseudo-element-selectors">Level 2</a> <a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element③②">pseudo-elements</a> (<a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-before" id="ref-for-selectordef-before⑦">::before</a>, <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-after" id="ref-for-selectordef-after②">::after</a>, <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-first-line" id="ref-for-selectordef-first-line⑨">::first-line</a>, and <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-first-letter" id="ref-for-selectordef-first-letter②">::first-letter</a>) may, for legacy reasons, be written with only a single ":" character at their front, making them resemble a <a class="production css" data-link-type="type" href="#typedef-pseudo-class-selector" id="ref-for-typedef-pseudo-class-selector⑦"><pseudo-class-selector></a>. </p> <h3 class="heading settled" data-level="18.1" id="forgiving-selector"><span class="secno">18.1. </span><span class="content"> <a class="production css" data-link-type="type" href="#typedef-forgiving-selector-list" id="ref-for-typedef-forgiving-selector-list①"><forgiving-selector-list></a> and <a class="production css" data-link-type="type" href="https://www.w3.org/TR/selectors-4/#typedef-forgiving-relative-selector-list" id="ref-for-typedef-forgiving-relative-selector-list"><forgiving-relative-selector-list></a></span><a class="self-link" href="#forgiving-selector"></a></h3> <p>For legacy reasons, the general behavior of a selector list is that if any selector in the list fails to parse (because it uses new or UA-specific selector features, for instance), the entire selector list becomes invalid. This can make it hard to write CSS that uses new selectors and still works correctly in older user agents.</p> <p>The <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-forgiving-selector-list"><a class="production css" data-link-type="type" href="#typedef-forgiving-selector-list" id="ref-for-typedef-forgiving-selector-list②"><forgiving-selector-list></a></dfn> production instead parses each selector in the list individually, simply ignoring ones that fail to parse, so the remaining selectors can still be used.</p> <p class="note" role="note"><span class="marker">Note:</span> Style rules still use the normal, unforgiving selector list behavior. <a class="production css" data-link-type="type" href="#typedef-forgiving-selector-list" id="ref-for-typedef-forgiving-selector-list③"><forgiving-selector-list></a> is used in <a class="css" data-link-type="maybe" href="#matches-pseudo" id="ref-for-matches-pseudo①⑧">:is()</a> and <a class="css" data-link-type="maybe" href="#where-pseudo" id="ref-for-where-pseudo⑦">:where()</a> only. Although it does have some minor implications on specificity, wrapping a style rule’s selector in <span class="css" id="ref-for-matches-pseudo①⑨">:is()</span> effectively "upgrades" it to become forgiving, so long as it doesn’t contain any pseudo-elements (which aren’t valid in <span class="css" id="ref-for-matches-pseudo②⓪">:is()</span> or <span class="css" id="ref-for-where-pseudo⑧">:where()</span>).</p> <p>Syntactically, <a class="production css" data-link-type="type" href="#typedef-forgiving-selector-list" id="ref-for-typedef-forgiving-selector-list④"><forgiving-selector-list></a> is equivalent to <code><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-syntax-3/#typedef-any-value" id="ref-for-typedef-any-value①"><any-value></a>?</code>. It is then <a data-link-type="dfn" href="#parse-as-a-forgiving-selector-list" id="ref-for-parse-as-a-forgiving-selector-list">parsed as a forgiving selector list</a> to obtain its actual value.</p> <div class="algorithm" data-algorithm="parse as a forgiving selector list"> To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="parse-as-a-forgiving-selector-list">parse as a forgiving selector list</dfn> given an input <var>input</var>: <ol> <li data-md> <p><a data-link-type="dfn" href="https://drafts.csswg.org/css-syntax-3/#css-parse-a-comma-separated-list-according-to-a-css-grammar" id="ref-for-css-parse-a-comma-separated-list-according-to-a-css-grammar">Parse a list</a> of <a class="production css" data-link-type="type" href="#typedef-complex-real-selector" id="ref-for-typedef-complex-real-selector②"><complex-real-selector></a>s from <var>input</var>, and let <var>selector list</var> be the result.</p> <li data-md> <p>Remove all failure items from <var>selector list</var>, and all items that are <a data-link-type="dfn" href="#invalid-selector" id="ref-for-invalid-selector④">invalid selectors</a>, then return a <a class="production css" data-link-type="type" href="#typedef-selector-list" id="ref-for-typedef-selector-list"><selector-list></a> representing the remaining items in <var>selector list</var>. (This might be empty.)</p> </ol> </div> <p>Any items in a <a class="production css" data-link-type="type" href="#typedef-forgiving-selector-list" id="ref-for-typedef-forgiving-selector-list⑤"><forgiving-selector-list></a> that are invalid (whether explicitly, by using unknown selectors or syntax, or merely contextually, using known syntax but in an invalid context) must be treated as having zero specificity.</p> <p class="note" role="note"><span class="marker">Note:</span> <a class="production css" data-link-type="type" href="#typedef-forgiving-selector-list" id="ref-for-typedef-forgiving-selector-list⑥"><forgiving-selector-list></a> is intentionally used only in <a class="css" data-link-type="maybe" href="#matches-pseudo" id="ref-for-matches-pseudo②①">:is()</a> and <a class="css" data-link-type="maybe" href="#where-pseudo" id="ref-for-where-pseudo⑨">:where()</a>, not in any other selector that takes a selector argument.</p> <h2 class="heading settled" data-level="19" id="api-hooks"><span class="secno">19. </span><span class="content"> API Hooks</span><a class="self-link" href="#api-hooks"></a></h2> <p>To aid in the writing of specs that use Selectors concepts, this section defines several API hooks that can be invoked by other specifications.</p> <p class="issue" id="issue-55d7bd68"><a class="self-link" href="#issue-55d7bd68"></a> Are these still necessary now that we have more rigorous definitions for <a data-link-type="dfn" href="#match" id="ref-for-match⑦">match</a> and <a data-link-type="dfn" href="#invalid-selector" id="ref-for-invalid-selector⑤">invalid selector</a>? Nouns are a lot easier to coordinate across specification than predicates, and details like the exact order of elements returned from <code>querySelector</code> seem to make more sense being defined in the DOM specification than in Selectors.</p> <h3 class="heading settled algorithm" data-algorithm="Parse A Selector" data-level="19.1" id="parse-selector"><span class="secno">19.1. </span><span class="content"> Parse A Selector</span><a class="self-link" href="#parse-selector"></a></h3> <p>This section defines how to <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="parse-a-selector">parse a selector</dfn> from a string <var>source</var>. It returns either a complex selector list, or failure.</p> <ol> <li> Let <var>selector</var> be the result of <a data-link-type="dfn" href="https://drafts.csswg.org/css-syntax-3/#css-parse-something-according-to-a-css-grammar" id="ref-for-css-parse-something-according-to-a-css-grammar①">parsing</a> <var>source</var> as a <a class="production css" data-link-type="type" href="#typedef-selector-list" id="ref-for-typedef-selector-list①"><selector-list></a>. If this returns failure, it’s an <a data-link-type="dfn" href="#invalid-selector" id="ref-for-invalid-selector⑥">invalid selector</a>; return failure. <li> If <var>selector</var> is an <a data-link-type="dfn" href="#invalid-selector" id="ref-for-invalid-selector⑦">invalid selector</a> for any other reason (such as, for example, containing an undeclared namespace prefix), return failure. <li> Otherwise, return <var>selector</var>. </ol> <h3 class="heading settled algorithm" data-algorithm="Parse A Relative Selector" data-level="19.2" id="parse-relative-selector"><span class="secno">19.2. </span><span class="content"> Parse A Relative Selector</span><a class="self-link" href="#parse-relative-selector"></a></h3> <p>This section defines how to <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="parse-a-relative-selector">parse a relative selector</dfn> from a string <var>source</var>. It returns either a complex selector list, or failure.</p> <ol> <li> Let <var>selector</var> be the result of <a data-link-type="dfn" href="https://drafts.csswg.org/css-syntax-3/#css-parse-something-according-to-a-css-grammar" id="ref-for-css-parse-something-according-to-a-css-grammar②">parsing</a> <var>source</var> as a <a class="production css" data-link-type="type" href="#typedef-relative-selector-list" id="ref-for-typedef-relative-selector-list③"><relative-selector-list></a>. If this returns failure, it’s an <a data-link-type="dfn" href="#invalid-selector" id="ref-for-invalid-selector⑧">invalid selector</a>; return failure. <li> If <var>selector</var> is an <a data-link-type="dfn" href="#invalid-selector" id="ref-for-invalid-selector⑨">invalid selector</a> for any other reason (such as, for example, containing an undeclared namespace prefix), return failure. <li> Otherwise, return <var>selector</var>. </ol> <h3 class="heading settled algorithm" data-algorithm="Match a Selector Against an Element" data-level="19.3" id="match-against-element"><span class="secno">19.3. </span><span class="content"> Match a Selector Against an Element</span><a class="self-link" href="#match-against-element"></a></h3> <p>This section defines how to <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="match-a-selector-against-an-element">match a selector against an element</dfn>.</p> <p>APIs using this algorithm must provide a <var>selector</var> and an <var>element</var>.</p> <p>Callers may optionally provide:</p> <ul> <li> one or more <a data-link-type="dfn" href="#scoping-root" id="ref-for-scoping-root⑨">scoping roots</a>, for resolving the <a class="css" data-link-type="maybe" href="#scope-pseudo" id="ref-for-scope-pseudo②">:scope</a> pseudo-class against. </ul> <p>This algorithm returns either success or failure.</p> <p>For each <a data-link-type="dfn" href="#complex" id="ref-for-complex⑧">complex selector</a> in the given <var>selector</var> (which is taken to be a <a data-link-type="dfn" href="#list-of-simple-selectors" id="ref-for-list-of-simple-selectors①">list of complex selectors</a>), match the complex selector against <var>element</var>, as described in the following paragraph. If the matching returns success for any complex selector, then the algorithm return success; otherwise it returns failure.</p> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="match-a-complex-selector-against-an-element">match a complex selector against an element</dfn>, process it <a data-link-type="dfn" href="#compound" id="ref-for-compound④④">compound selector</a> at a time, in right-to-left order. This process is defined recursively as follows:</p> <ul> <li>If any simple selectors in the rightmost compound selector does not match the element, return failure. <li>Otherwise, if there is only one compound selector in the complex selector, return success. <li>Otherwise, consider all possible elements that could be related to this element by the rightmost <a data-link-type="dfn" href="#selector-combinator" id="ref-for-selector-combinator⑧">combinator</a>. If the operation of matching the selector consisting of this selector with the rightmost compound selector and rightmost combinator removed against any one of these elements returns success, then return success. Otherwise, return failure. </ul> <h3 class="heading settled algorithm" data-algorithm="Match a Selector Against a Pseudo-element" data-level="19.4" id="match-against-pseudo-element"><span class="secno">19.4. </span><span class="content"> Match a Selector Against a Pseudo-element</span><a class="self-link" href="#match-against-pseudo-element"></a></h3> <p>This section defines how to <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="match-a-selector-against-a-pseudo-element">match a selector against a pseudo-element</dfn>.</p> <p>APIs using this algorithm must provide a <var>selector</var> and a <var>pseudo-element</var>. They may optionally provide the same things they may optionally provide to the algorithm to <a data-link-type="dfn" href="#match-a-selector-against-an-element" id="ref-for-match-a-selector-against-an-element">match a selector against an element</a>.</p> <p>This algorithm returns success or failure.</p> <p>For each <a data-link-type="dfn" href="#complex" id="ref-for-complex⑨">complex selector</a> in the given <var>selector</var>, if both:</p> <ul> <li>the rightmost <a data-link-type="dfn" href="#simple" id="ref-for-simple①⑥">simple selector</a> in the complex selector matches <var>pseudo-element</var>, and <li>the result of running <a data-link-type="dfn" href="#match-a-complex-selector-against-an-element" id="ref-for-match-a-complex-selector-against-an-element">match a complex selector against an element</a> on the remainder of the <a data-link-type="dfn" href="#complex" id="ref-for-complex①⓪">complex selector</a> (with just the rightmost simple selector of its rightmost complex selector removed), <var>pseudo-element</var>’s corresponding element, and any optional parameters provided to this algorithm returns success, </ul> then return success. <p>Otherwise (that is, if this doesn’t happen for any of the complex selectors in <var>selector</var>), return failure.</p> <h3 class="heading settled algorithm" data-algorithm="Match a Selector Against a Tree" data-level="19.5" id="match-against-tree"><span class="secno">19.5. </span><span class="content"> Match a Selector Against a Tree</span><a class="self-link" href="#match-against-tree"></a></h3> <p>This section defines how to <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="match-a-selector-against-a-tree">match a selector against a tree</dfn>.</p> <p>APIs using this algorithm must provide a selector, and one or more <var>root elements</var> indicating the <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-tree" id="ref-for-concept-tree">subtrees</a> that will be searched by the selector. All of the <var>root elements</var> must share the same <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-tree-root" id="ref-for-concept-tree-root">root</a>, or else calling this algorithm is invalid.</p> <p>They may optionally provide:</p> <ul> <li> One or more <a data-link-type="dfn" href="#scoping-root" id="ref-for-scoping-root①⓪">scoping roots</a> indicating the selector is <a data-link-type="dfn" href="#scoped-selector" id="ref-for-scoped-selector②">scoped</a>. <li> A list of <a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element③③">pseudo-elements</a> that are allowed to show up in the match list. If not specified, this defaults to allowing all pseudo-elements. <p class="issue" id="issue-15f3317f"><a class="self-link" href="#issue-15f3317f"></a> Only the <a data-link-type="dfn" href="https://drafts.csswg.org/css-pseudo-4/#tree-abiding" id="ref-for-tree-abiding②">tree-abiding pseudo-elements</a> are really handled in any way remotely like this.</p> </ul> <p>This algorithm returns a (possibly empty) list of elements.</p> <ol> <li> Start with a list of <var>candidate elements</var>, which are the <var>root elements</var> and all of their descendant elements, sorted in <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-shadow-including-tree-order" id="ref-for-concept-shadow-including-tree-order">shadow-including tree order</a>, unless otherwise specified. <li> If <a data-link-type="dfn" href="#scoping-root" id="ref-for-scoping-root①①">scoping root</a> were provided, then remove from the <var>candidate elements</var> any elements that are not <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-tree-descendant" id="ref-for-concept-tree-descendant">descendants</a> of at least one <span id="ref-for-scoping-root①②">scoping root</span>. <li> Initialize the <var>selector match list</var> to empty. <li> For each <var>element</var> in the set of <var>candidate elements</var>: <ol> <li> If the result of <a data-link-type="dfn" href="#match-a-selector-against-an-element" id="ref-for-match-a-selector-against-an-element①">match a selector against an element</a> for <var>element</var> and <var>selector</var> is success, add <var>element</var> to the <var>selector match list</var>. <li> For each possible pseudo-element associated with <var>element</var> that is one of the pseudo-elements allowed to show up in the match list, if the result of <a data-link-type="dfn" href="#match-a-selector-against-a-pseudo-element" id="ref-for-match-a-selector-against-a-pseudo-element">match a selector against a pseudo-element</a> for the pseudo-element and <var>selector</var> is success, add the pseudo-element to the <var>selector match list</var>. <p class="issue" id="issue-b7f52036"><a class="self-link" href="#issue-b7f52036"></a> The relative position of pseudo-elements in <var>selector match list</var> is undefined. There’s not yet a context that exposes this information, but we need to decide on something eventually, before something <em>is</em> exposed.</p> </ol> </ol> <h2 class="heading settled" id="dom-mapping"><span class="content"> Appendix A: Guidance on Mapping Source Documents & Data to an Element Tree</span><a class="self-link" href="#dom-mapping"></a></h2> <p><em>This section is informative.</em></p> <p>The element tree structure described by the DOM is powerful and useful, but generic enough to model pretty much any language that describes tree-based data (or even graph-based, with a suitable interpretation).</p> <p>Some languages, like HTML, already have well-defined procedures for producing a DOM object from a resource. If a given language does not, such a procedure must be defined in order for Selectors to apply to documents in that language.</p> <p>At minimum, the document language must define what maps to the DOM concept of an "element".</p> <p>The primary one-to-many relationship between nodes—parent/child in tree-based structures, element/neighbors in graph-based structures—should be reflected as the child nodes of an element.</p> <p>Other features of the element should be mapped to something that serves a similar purpose to the same feature in DOM:</p> <dl> <dt>type <dd> If the elements in the document language have some notion of "type" as a basic distinguisher between different groups of elements, it should be reflected as the "type" feature. <p>If this "type" can be separated into a "basic" name and a "namespace" that groups names into higher-level groups, the latter should be reflected as the "namespace" feature. Otherwise, the element shouldn’t have a "namespace" feature, and the entire name should be reflected as the "type" feature.</p> <dt>id <dd> If some aspect of the element functions as a unique identifier across the document, it should be mapped to the "id" feature. <p class="note" role="note"><span class="marker">Note:</span> While HTML only allows an element to have a single ID, this should not be taken as a general restriction. The important quality of an ID is that each ID should be associated with a single element; a single element can validly have multiple IDs.</p> <dt>classes and attributes <dd> Aspects of the element that are useful for identifying the element, but are not generally unique to elements within a document, should be mapped to the "class" or "attribute" features depending on if they’re something equivalent to a "label" (a string by itself) or a "property" (a name/value pair) <dt>pseudo-classes and pseudo-elements <dd> If any elements match any pseudo-classes or have any pseudo-elements, that must be explicitly defined. <p class="issue" id="issue-772ec278"><a class="self-link" href="#issue-772ec278"></a> Some pseudo-classes are *syntactical*, like <a class="css" data-link-type="maybe" href="#has-pseudo" id="ref-for-has-pseudo①②">:has()</a> and <a class="css" data-link-type="maybe" href="#matches-pseudo" id="ref-for-matches-pseudo②②">:is()</a>, and thus should always work. Need to indicate that somewhere. Probably the structural pseudos always work whenever the child list is ordered.</p> </dl> <div class="example" id="example-37a1ab6b"> <a class="self-link" href="#example-37a1ab6b"></a> For example, <a href="https://github.com/lloyd/JSONSelect">JSONSelect</a> is a library that uses selectors to extract information from JSON documents. <ul> <li> The "elements" of the JSON document are each array, object, boolean, string, number, or null. The array and object elements have their contents as children. <li> Each element’s type is its JS type name: "array", "object", etc. <li> Children of an object have their key as a class. <li> Children of an array match the <a class="css" data-link-type="maybe" href="#first-child-pseudo" id="ref-for-first-child-pseudo②">:first-child</a>, <a class="css" data-link-type="maybe" href="#nth-child-pseudo" id="ref-for-nth-child-pseudo⑤">:nth-child()</a>, etc pseudo-classes. <li> The root object matches <a class="css" data-link-type="maybe" href="#root-pseudo" id="ref-for-root-pseudo③">:root</a>. <li> It additionally defines <span class="css">:val()</span> and <span class="css">:contains()</span> pseudo-classes, for matching boolean/number/string elements with a particular value or which contain a particular substring. </ul> <p>This structure is sufficient to allow powerful, compact querying of JSON documents with selectors.</p> </div> <h2 class="heading settled" id="compat"><span class="content"> Appendix B: Obsolete but Required <code>-webkit-</code> Parsing Quirks for Web Compat</span><a class="self-link" href="#compat"></a></h2> <p><em>This appendix is normative.</em></p> <p>Due to legacy Web-compat constraints, user agents expecting to parse Web documents must support the following features:</p> <ul> <li data-md> <p><span class="css">:-webkit-autofill</span> must be treated as a <a data-link-type="dfn" href="#legacy-selector-alias" id="ref-for-legacy-selector-alias①">legacy selector alias</a> of <a class="css" data-link-type="maybe" href="#selectordef-autofill" id="ref-for-selectordef-autofill①">:autofill</a>.</p> <li data-md> <p>All other <a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element③④">pseudo-elements</a> whose names begin with the string “-webkit-” (matched <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive⑧">ASCII case-insensitively</a>) and that are not functional notations must be treated as valid at parse time. (That is, <span class="css">::-webkit-asdf</span> is valid at parse time, but <span class="css">::-webkit-jkl()</span> is not.) If they’re not otherwise recognized and supported, they must be treated as matching nothing, and are <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="unknown--webkit--pseudo-elements">unknown -webkit- pseudo-elements</dfn>.</p> <p><a data-link-type="dfn" href="#unknown--webkit--pseudo-elements" id="ref-for-unknown--webkit--pseudo-elements">Unknown -webkit- pseudo-elements</a> must be serialized in ASCII lowercase.</p> <details class="note"> <summary>What’s this quirk about?</summary> <p>Selectors have long had a behavior where a single unknown/invalid selector invalidates the entire selector list (rather than just invalidating the one complex selector it finds itself in). This is generally considered a legacy mistake by the WG, but can’t be fixed at this point, as too many stylesheets depend on this behavior, intentionally or not.</p> <p>One aspect of this is that use of vendor-specific selectors invalidates the entire selector in other user agents that don’t recognize them, and takes the entire style rule down with it. This has been used intentionally in the past—in the severely-not-recommended practice of hiding style rules from some browsers by making them invalid in every other browser—and unintentionally, with people styling an element and also applying those styles to a vendor-specific pseudo-element (such as the various <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/input.html#the-input-element" id="ref-for-the-input-element⑤">input</a></code>-related pseudos some browsers expose), not realizing that this hides the entire rule from other browsers.</p> <p>In addition to this more general reasoning, WebKit-derived user agents, such as Safari or Chrome, have an additional quirk related to their vendor-prefixed pseudo-elements, where any <span class="css">::-webkit-</span>-prefixed selectors are considered valid at parse time. (This is probably a leftover quirk of an early CSS feature, since dropped, that intentionally treated all possible pseudo-elements as valid at parse time, in anticipation of a feature letting authors define their own pseudo-elements.)</p> <p>Similar to other legacy quirks, such as those documented in <a data-link-type="biblio" href="#biblio-quirks" title="Quirks Mode Standard">[QUIRKS]</a>, this particular vendor-specific oddity has become common enough that other user agents are seeing sites breaking due to them depending on it, accidentally or not. As such, since the quirk is in practical terms <em>required</em> to render the modern web correctly, specifying it and requiring it for all user agents ensures that today’s web pages are more likely to be correctly rendered in user agents both current and future.</p> <p>As usual with quirks, however, webpages intentionally relying on this will be met with shaming and derision from members of the CSSWG, and all right-thinking web developers.</p> </details> </ul> <h2 class="heading settled" data-level="20" id="changes"><span class="secno">20. </span><span class="content"> Changes</span><a class="self-link" href="#changes"></a></h2> <h3 class="heading settled" data-level="20.1" id="changes-2022-05"><span class="secno">20.1. </span><span class="content"> Changes since the 7 May 2022 Working Draft</span><a class="self-link" href="#changes-2022-05"></a></h3> <p>Significant changes since the <a href="https://www.w3.org/TR/2022/WD-selectors-4-20220507/">7 May 2022 Working Draft</a>:</p> <ul> <li data-md> <p>Marked <a class="css" data-link-type="maybe" href="#blank-pseudo" id="ref-for-blank-pseudo⑧">:blank</a> as at-risk and removed the at-risk status from <a class="css" data-link-type="maybe" href="#read-write-pseudo" id="ref-for-read-write-pseudo②">:read-write</a> and <a class="css" data-link-type="maybe" href="#has-pseudo" id="ref-for-has-pseudo①③">:has()</a></p> <li data-md> <p>Added <a class="css" data-link-type="maybe" href="#selectordef-open" id="ref-for-selectordef-open②">:open</a> and <a class="css" data-link-type="maybe" href="#selectordef-closed" id="ref-for-selectordef-closed①">:closed</a> pseudo-classes. (<a href="https://github.com/w3c/csswg-drafts/issues/7319">Issue 7319</a>)</p> <li data-md> <p>Disallowed <a data-link-type="dfn" href="#pseudo-element" id="ref-for-pseudo-element③⑤">pseudo-elements</a> from <a class="css" data-link-type="maybe" href="#has-pseudo" id="ref-for-has-pseudo①④">:has()</a> unless explicitly allowed by the pseudo-element’s definition. (<a href="https://github.com/w3c/csswg-drafts/issues/7463">Issue 7463</a>)</p> <li data-md> <p>Disallowed nesting of <a class="css" data-link-type="maybe" href="#has-pseudo" id="ref-for-has-pseudo①⑤">:has()</a>. (<a href="https://github.com/w3c/csswg-drafts/issues/7344">Issue 7344</a>)</p> <li data-md> <p>Made <a class="css" data-link-type="maybe" href="#has-pseudo" id="ref-for-has-pseudo①⑥">:has()</a> and the selector argument of <a class="css" data-link-type="maybe" href="#nth-child-pseudo" id="ref-for-nth-child-pseudo⑥">:nth-child()</a>/<a class="css" data-link-type="maybe" href="#nth-last-child-pseudo" id="ref-for-nth-last-child-pseudo③">:nth-last-child()</a> no longer forgiving. (<a href="https://github.com/w3c/csswg-drafts/issues/7676">Issue 7676</a>)</p> <li data-md> <p>Defined matching of <span class="css">::lang("")</span> and of elements not tagged with a language. (<a href="https://github.com/w3c/csswg-drafts/issues/6915">Issue 6915</a>)</p> <li data-md> <p>Untangled the concepts of "scoped" and "relative" selectors completely. (<a href="https://github.com/w3c/csswg-drafts/issues/6399">Issue 6399</a>)</p> <ul> <li data-md> <p>Removed "absolutize a selector" as well, and just defined relative selector matching in terms of the anchoring element.</p> </ul> <li data-md> <p>Reverted compound selector limitation on <a class="css" data-link-type="maybe" href="#nth-child-pseudo" id="ref-for-nth-child-pseudo⑦">:nth-child()</a>. (<a href="https://github.com/w3c/csswg-drafts/issues/3760">Issue 3760</a>)</p> <li data-md> <p>Defined <span class="css">:-webkit-autofill</span> <a data-link-type="dfn" href="#legacy-selector-alias" id="ref-for-legacy-selector-alias②">legacy selector alias</a>. (<a href="https://github.com/w3c/csswg-drafts/issues/7474">Issue 7474</a>)</p> <li data-md> <p>Moved the legacy single-colon pseudo-element syntax into the grammar itself. (<a href="https://github.com/w3c/csswg-drafts/issues/8122">Issue 8122</a>)</p> </ul> <h3 class="heading settled" data-level="20.2" id="changes-2018-11"><span class="secno">20.2. </span><span class="content"> Changes since the 21 November 2018 Working Draft</span><a class="self-link" href="#changes-2018-11"></a></h3> <p>Significant changes since the <a href="https://www.w3.org/TR/2018/WD-selectors-4-20181121/">21 November 2018 Working Draft</a>:</p> <ul> <li>Removed the Selector profiles, marked <a class="css" data-link-type="maybe" href="#has-pseudo" id="ref-for-has-pseudo①⑦">:has()</a> as optional and at-risk instead. (<a href="https://github.com/w3c/csswg-drafts/issues/3925">Issue 3925</a>) <li>Added <a href="#sub-pseudo-elements">§ 3.6.4 Sub-pseudo-elements</a> to define <a data-link-type="dfn" href="#sub-pseudo-element" id="ref-for-sub-pseudo-element③">sub-pseudo-elements</a> and related terminology. <li>Added <a class="css" data-link-type="maybe" href="#defined-pseudo" id="ref-for-defined-pseudo③">:defined</a>. (<a href="https://github.com/w3c/csswg-drafts/issues/2258">Issue 2258</a>) <li>Added <a class="css" data-link-type="maybe" href="#selectordef-modal" id="ref-for-selectordef-modal④">:modal</a>. (<a href="https://github.com/w3c/csswg-drafts/issues/6965">Issue 6965</a>) <li>Added <a class="css" data-link-type="maybe" href="#selectordef-fullscreen" id="ref-for-selectordef-fullscreen②">:fullscreen</a> and <a class="css" data-link-type="maybe" href="#selectordef-picture-in-picture" id="ref-for-selectordef-picture-in-picture①">:picture-in-picture</a>. (<a href="https://github.com/w3c/csswg-drafts/issues/3796">Issue 3796</a>) <li>Added <a class="css" data-link-type="maybe" href="#selectordef-seeking" id="ref-for-selectordef-seeking①">:seeking</a>, <a class="css" data-link-type="maybe" href="#selectordef-buffering" id="ref-for-selectordef-buffering③">:buffering</a>, and <a class="css" data-link-type="maybe" href="#selectordef-stalled" id="ref-for-selectordef-stalled②">:stalled</a> media playback state pseudo-classes. (<a href="https://github.com/w3c/csswg-drafts/issues/3821">Issue 3821</a>) <li>Added <a class="css" data-link-type="maybe" href="#selectordef-muted" id="ref-for-selectordef-muted①">:muted</a> and <a class="css" data-link-type="maybe" href="#selectordef-volume-locked" id="ref-for-selectordef-volume-locked①">:volume-locked</a> sound state pseudo-classes. (<a href="https://github.com/w3c/csswg-drafts/issues/3821">Issue 3821</a> and <a href="https://github.com/w3c/csswg-drafts/issues/3933">Issue 3933</a>) <li>Added <a class="css" data-link-type="maybe" href="#selectordef-autofill" id="ref-for-selectordef-autofill②">:autofill</a>. (<a href="https://github.com/w3c/csswg-drafts/issues/5775">Issue 5775</a>) <li>Added <a class="css" data-link-type="maybe" href="#user-valid-pseudo" id="ref-for-user-valid-pseudo②">:user-valid</a>. (<a href="https://lists.w3.org/Archives/Public/www-style/2015Sep/0111.html">Discussion</a>) <li>Defined <a class="css" data-link-type="maybe" href="#matches-pseudo" id="ref-for-matches-pseudo②③">:is()</a>, <a class="css" data-link-type="maybe" href="#where-pseudo" id="ref-for-where-pseudo①⓪">:where()</a>, <a class="css" data-link-type="maybe" href="#has-pseudo" id="ref-for-has-pseudo①⑧">:has()</a>, <a class="css" data-link-type="maybe" href="#nth-child-pseudo" id="ref-for-nth-child-pseudo⑧">:nth-child()</a>, and <a class="css" data-link-type="maybe" href="#nth-last-child-pseudo" id="ref-for-nth-last-child-pseudo④">:nth-last-child()</a> to not be themselves invalidated when containing an invalid selector. (<a href="https://github.com/w3c/csswg-drafts/issues/3264">Issue 3264</a>) <li>Limited selectors in <a class="css" data-link-type="maybe" href="#nth-child-pseudo" id="ref-for-nth-child-pseudo⑨">:nth-child()</a> and <a class="css" data-link-type="maybe" href="#nth-last-child-pseudo" id="ref-for-nth-last-child-pseudo⑤">:nth-last-child()</a> to <a data-link-type="dfn" href="#compound" id="ref-for-compound④⑤">compound selectors</a> for now. (<a href="https://github.com/w3c/csswg-drafts/issues/3760">Issue 3760</a>) <li>Clarified case-sensitive string matching by referencing string identity as defined in <a data-link-type="biblio" href="#biblio-infra" title="Infra Standard">[INFRA]</a>. <li>Clarified that UA-provided placeholder text still triggers <a class="css" data-link-type="maybe" href="#placeholder-shown-pseudo" id="ref-for-placeholder-shown-pseudo②">:placeholder-shown</a>. <li>Rewrote <a class="css" data-link-type="maybe" href="#focus-visible-pseudo" id="ref-for-focus-visible-pseudo⑤">:focus-visible</a> definition for clarity. <li>Switched reminder note in the grammar section to normative text describing the requirement of whitespace between <a class="production css" data-link-type="type" href="#typedef-compound-selector" id="ref-for-typedef-compound-selector⑧"><compound-selector></a>s when a <a class="production css" data-link-type="type" href="#typedef-combinator" id="ref-for-typedef-combinator⑥"><combinator></a> token is missing. </ul> <h3 class="heading settled" data-level="20.3" id="changes-2018-02"><span class="secno">20.3. </span><span class="content"> Changes since the 2 February 2018 Working Draft</span><a class="self-link" href="#changes-2018-02"></a></h3> <p>Significant changes since the <a href="https://www.w3.org/TR/2018/WD-selectors-4-20180202/">2 February 2018 Working Draft</a>:</p> <ul> <li>Named the zero-specificity selector to <a class="css" data-link-type="maybe" href="#where-pseudo" id="ref-for-where-pseudo①①">:where()</a>. (<a href="https://github.com/w3c/csswg-drafts/issues/2143">Issue 2143</a>) <li>Renamed <a class="css" data-link-type="maybe" href="#selectordef-matches" id="ref-for-selectordef-matches">:matches()</a> to <a class="css" data-link-type="maybe" href="#matches-pseudo" id="ref-for-matches-pseudo②④">:is()</a>. (<a href="https://github.com/w3c/csswg-drafts/issues/3258">Issue 3258</a>) <li>Redefined <a class="css" data-link-type="maybe" href="#empty-pseudo" id="ref-for-empty-pseudo②">:empty</a> to ignore white-space–only nodes. (<a href="https://github.com/w3c/csswg-drafts/issues/1967">Issue 1967</a>) <li>Redefined <a class="css" data-link-type="maybe" href="#blank-pseudo" id="ref-for-blank-pseudo⑨">:blank</a> to represent empty user input, rather than empty elements. (<a href="https://github.com/w3c/csswg-drafts/issues/1283">Issue 1283</a>) <li>Changed the specificity of <a class="css" data-link-type="maybe" href="#matches-pseudo" id="ref-for-matches-pseudo②⑤">:is()</a>, <a class="css" data-link-type="maybe" href="#has-pseudo" id="ref-for-has-pseudo①⑨">:has()</a>, and <a class="css" data-link-type="maybe" href="#nth-child-pseudo" id="ref-for-nth-child-pseudo①⓪">:nth-child()</a> to not depend on which selector argument matched. (<a href="https://github.com/w3c/csswg-drafts/issues/1027">Issue 1027</a>) <li>Dropped the <span class="css">:drop()</span> pseudo-classes since HTML dropped the related feature. (<a href="https://github.com/w3c/csswg-drafts/issues/2257">Issue 2257</a>) <li>Added the case-sensitive flag <code>s</code> to the attribute selector. (<a href="https://github.com/w3c/csswg-drafts/issues/2101">Issue 2101</a>) <li>Added further guidance on <a class="css" data-link-type="maybe" href="#focus-visible-pseudo" id="ref-for-focus-visible-pseudo⑥">:focus-visible</a>. <li>Added <a href="#compat">Appendix B: Obsolete but Required -webkit- Parsing Quirks for Web Compat</a> defining <span class="css">::-webkit-</span> pseudo-element parsing quirk. (<a href="https://github.com/w3c/csswg-drafts/issues/3051">Issue 3051</a>) <li>Rewrote grammar rules about where white space is allowed for clarity. (See <a href="#grammar">§ 18 Grammar</a>.) </ul> <h3 class="heading settled" data-level="20.4" id="changes-2013"><span class="secno">20.4. </span><span class="content"> Changes since the 2 May 2013 Working Draft</span><a class="self-link" href="#changes-2013"></a></h3> <p>Significant changes since the <a href="https://www.w3.org/TR/2013/WD-selectors4-20130502/">2 May 2013 Working Draft</a> include:</p> <ul> <li>Added the <a class="css" data-link-type="maybe" href="#target-within-pseudo" id="ref-for-target-within-pseudo②">:target-within</a>, <a class="css" data-link-type="maybe" href="#focus-within-pseudo" id="ref-for-focus-within-pseudo②">:focus-within</a>, <a class="css" data-link-type="maybe" href="#focus-visible-pseudo" id="ref-for-focus-visible-pseudo⑦">:focus-visible</a>, <a class="css" data-link-type="maybe" href="#selectordef-playing" id="ref-for-selectordef-playing③">:playing</a>, and <a class="css" data-link-type="maybe" href="#selectordef-paused" id="ref-for-selectordef-paused①">:paused</a> pseudo-classes. <li>Added a zero-specificity <a class="css" data-link-type="maybe" href="#selectordef-matches" id="ref-for-selectordef-matches①">:matches()</a>-type pseudo-class, with name TBD. <li>Replaced subject indicator (<span class="css">!</span>) feature with <a class="css" data-link-type="maybe" href="#has-pseudo" id="ref-for-has-pseudo②⓪">:has()</a>. <li>Replaced the <span class="css">:nth-match()</span> and <span class="css">:nth-last-match()</span> selectors with <span class="css">:nth-child(… of <var>selector</var>)</span> and <span class="css">:nth-last-child(… of <var>selector</var>)</span>. <li>Changed the <span class="css">:active-drop-target</span>, <span class="css">:valid-drop-target</span>, <span class="css">:invalid-drop-target</span> with <span class="css">:drop()</span>. <li>Sketched out an empty-or-whitespace-only selector for discussion (See <a href="https://github.com/w3c/csswg-drafts/issues/1967">open issue</a>.) <li>Renamed <span class="css">:user-error</span> to <a class="css" data-link-type="maybe" href="#user-invalid-pseudo" id="ref-for-user-invalid-pseudo④">:user-invalid</a>. (See <a href="https://www.w3.org/mid/CADhPm3v+WfeGQfBwwx8QBuiOjn2k38V_DcKW17Cm81VgZb1nbQ@mail.gmail.com">Discussion</a>) <li>Renamed <span class="css">:nth-column()</span>/<span class="css">:nth-last-column()</span> to <a class="css" data-link-type="maybe" href="#nth-col-pseudo" id="ref-for-nth-col-pseudo②">:nth-col()</a>/<a class="css" data-link-type="maybe" href="#nth-last-col-pseudo" id="ref-for-nth-last-col-pseudo②">:nth-last-col()</a> to avoid naming confusion with a potential <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-multicol-2/#selectordef-column" id="ref-for-selectordef-column">::column</a> pseudo-class. <li>Changed the non-functional form of the <span class="css">:local-link</span> pseudo-class to account for fragment URLs. <li>Removed the functional form of the <code>:local-link()</code> pseudo-class and reference combinator for lack of interest. <li>Rewrote selectors grammar using the CSS Value Definition Syntax. <li>Split out <a data-link-type="dfn" href="#relative-selector" id="ref-for-relative-selector②">relative selectors</a> from <a data-link-type="dfn" href="#scoped-selector" id="ref-for-scoped-selector③">scoped selectors</a>, as these are different concepts that can be independently invoked. <li> Moved definition of <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-syntax-3/#anb-production" id="ref-for-anb-production"><An+B></a> microsyntax to CSS Syntax. <p class="issue" id="issue-fb60ae39"><a class="self-link" href="#issue-fb60ae39"></a> Semantic definition should probably move back here.</p> <li> Added new sections: <ul> <li> <a href="#data-model">§ 3.2 Data Model</a> <p class="issue" id="issue-4ca3978c"><a class="self-link" href="#issue-4ca3978c"></a> Need to define tree for XML.</p> <li> <a href="#api-hooks">§ 19 API Hooks</a> <ul> <li>Note that earlier versions of this section defined a section on <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="evaluating-selectors">evaluating a selector</dfn>, but that section is no longer present. Specifications referencing that section should instead reference the algorithm to <a data-link-type="dfn" href="#match-a-selector-against-a-tree" id="ref-for-match-a-selector-against-a-tree">match a selector against a tree</a>. </ul> </ul> <li>Removed restriction on combinators within <a class="css" data-link-type="maybe" href="#selectordef-matches" id="ref-for-selectordef-matches②">:matches()</a> and <a class="css" data-link-type="maybe" href="#negation-pseudo" id="ref-for-negation-pseudo⑨">:not()</a>; see <a href="https://lists.w3.org/Archives/Public/www-style/2014Jan/0607.html">discussion</a>. <li>Defined <a data-link-type="dfn" href="#specificity" id="ref-for-specificity②">specificity</a> of a <a data-link-type="dfn" href="#selector-list" id="ref-for-selector-list①③">selector list</a>. (Why?) <li>Required quotes around <a class="css" data-link-type="maybe" href="#lang-pseudo" id="ref-for-lang-pseudo⑥">:lang()</a> values involving an asterisk; only language codes which happen to be CSS identifiers can be used unquoted. </ul> <p class="note" role="note"><span class="marker">Note:</span> The 1 February 2018 draft included an inadvertent commit of unfinished work; 2 February 2018 has reverted this commit (and fixed some links because why not).</p> <h3 class="heading settled" data-level="20.5" id="changes-2012"><span class="secno">20.5. </span><span class="content"> Changes since the 23 August 2012 Working Draft</span><a class="self-link" href="#changes-2012"></a></h3> <p>Significant changes since the <a href="https://www.w3.org/TR/2012/WD-selectors4-20120823/">23 August 2012 Working Draft</a> include:</p> <ul> <li>Added <a class="css" data-link-type="maybe" href="#placeholder-shown-pseudo" id="ref-for-placeholder-shown-pseudo③">:placeholder-shown</a> pseudo-classes. <li>Released some restrictions on <a class="css" data-link-type="maybe" href="#selectordef-matches" id="ref-for-selectordef-matches③">:matches()</a> and <a class="css" data-link-type="maybe" href="#negation-pseudo" id="ref-for-negation-pseudo①⓪">:not()</a>. <li>Defined fast and complete Selectors profiles (now called “live” and “snapshot”). <li>Improved definition of <a data-link-type="dfn" href="#specificity" id="ref-for-specificity③">specificity</a> to better handle <a class="css" data-link-type="selector" href="#selectordef-matches" id="ref-for-selectordef-matches④">:matches()</a>. <li>Updated grammar. <li>Cleaned up definition of <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-syntax-3/#anb-production" id="ref-for-anb-production①"><An+B></a> notation. <li>Added definition of <i>scope-relative</i> selectors, changed <i>scope-constrained</i> to scope-filtered for less confusion with scope-contained. <li>The <span class="css">:local-link()</span> pseudo-class now ignores trailing slashes. </ul> <h3 class="heading settled" data-level="20.6" id="changes-2011"><span class="secno">20.6. </span><span class="content"> Changes since the 29 September 2011 Working Draft</span><a class="self-link" href="#changes-2011"></a></h3> <p>Significant changes since the <a href="https://www.w3.org/TR/2011/WD-selectors4-20110929/">29 September 2011 Working Draft</a> include:</p> <ul> <li>Added language variant handling per RFC 4647. <li>Added scoped selectors. <li>Added <span class="css">:user-error</span> (now called <a class="css" data-link-type="maybe" href="#user-invalid-pseudo" id="ref-for-user-invalid-pseudo⑤">:user-invalid</a>). <li>Added <span class="css">:valid-drop-target</span>. <li>Changed <a data-link-type="dfn" href="#column-combinator" id="ref-for-column-combinator①">column combinator</a> from double slash to double pipe. </ul> <h3 class="heading settled" data-level="20.7" id="changes-level-3"><span class="secno">20.7. </span><span class="content"> Changes Since Level 3</span><a class="self-link" href="#changes-level-3"></a></h3> <p>Additions since <a href="https://www.w3.org/TR/selectors-3/">Level 3</a>:</p> <ul> <li>Extended <a class="css" data-link-type="maybe" href="#negation-pseudo" id="ref-for-negation-pseudo①①">:not()</a> to accept a selector list. <li>Added <a class="css" data-link-type="maybe" href="#matches-pseudo" id="ref-for-matches-pseudo②⑥">:is()</a> and <a class="css" data-link-type="maybe" href="#where-pseudo" id="ref-for-where-pseudo①②">:where()</a> and <a class="css" data-link-type="maybe" href="#has-pseudo" id="ref-for-has-pseudo②①">:has()</a>. <li>Added <a class="css" data-link-type="maybe" href="#scope-pseudo" id="ref-for-scope-pseudo③">:scope</a>. <li>Added <a class="css" data-link-type="maybe" href="#any-link-pseudo" id="ref-for-any-link-pseudo①">:any-link</a> and <a class="css" data-link-type="maybe" href="#local-link-pseudo" id="ref-for-local-link-pseudo②">:local-link</a>. <li>Added <a href="#time-pseudos">time-dimensional pseudo-classes</a>. <li>Added <a class="css" data-link-type="maybe" href="#target-within-pseudo" id="ref-for-target-within-pseudo③">:target-within</a>, <a class="css" data-link-type="maybe" href="#focus-within-pseudo" id="ref-for-focus-within-pseudo③">:focus-within</a>, and <a class="css" data-link-type="maybe" href="#focus-visible-pseudo" id="ref-for-focus-visible-pseudo⑧">:focus-visible</a>. <li>Added <a class="css" data-link-type="maybe" href="#dir-pseudo" id="ref-for-dir-pseudo③">:dir()</a>. <li>Expanded <a class="css" data-link-type="maybe" href="#lang-pseudo" id="ref-for-lang-pseudo⑦">:lang()</a> to accept wildcard matching and lists of language codes. <li>Expanded <span class="css">:nth-child()</span> to accept a selector list. <li>Merged in input selectors from <a href="https://www.w3.org/TR/css-ui-3/">CSS Basic User Interface Module Level 3</a> and added back <a class="css" data-link-type="maybe" href="#indeterminate-pseudo" id="ref-for-indeterminate-pseudo④">:indeterminate</a>. <li>Added <a class="css" data-link-type="maybe" href="#blank-pseudo" id="ref-for-blank-pseudo①⓪">:blank</a> and <a class="css" data-link-type="maybe" href="#user-invalid-pseudo" id="ref-for-user-invalid-pseudo⑥">:user-invalid</a>. <li>Added <a href="#table-pseudos">grid-structural (column) selectors</a>. <li>Added case-insensitive / case-sensitive attribute-value matching flags. </ul> <h2 class="heading settled" data-level="21" id="acknowledgements"><span class="secno">21. </span><span class="content"> Acknowledgements</span><a class="self-link" href="#acknowledgements"></a></h2> <p>The CSS working group would like to thank everyone who contributed to the <a href="https://www.w3.org/TR/css3-selectors">previous Selectors</a> specifications over the years, as those specifications formed the basis for this one. In particular, the working group would like to extend special thanks to the following for their specific contributions to Selectors Level 4: L. David Baron, Andrew Fedoniouk, Daniel Glazman, Ian Hickson, Grey Hodge, Lachlan Hunt, Anne van Kesteren, Jason Cranford Teague, Lea Verou</p> <h2 class="no-num heading settled" id="privacy"><span class="content">Privacy Considerations</span><a class="self-link" href="#privacy"></a></h2> <ul> <li> The <a class="css" data-link-type="maybe" href="#visited-pseudo" id="ref-for-visited-pseudo③">:visited</a> pseudo-class can expose information about which sites a user has previously visited, if the UA is not careful to screen from scripting any information that would reveal which elements match it. <li> The <a class="css" data-link-type="maybe" href="#selectordef-autofill" id="ref-for-selectordef-autofill③">:autofill</a> pseudo-class can expose whether a user has interacted with this form before; however the same information can be derived by observing how quickly the form is filled out. </ul> <h2 class="no-num heading settled" id="security"><span class="content">Security Considerations</span><a class="self-link" href="#security"></a></h2> <p>The <a href="#privacy">Privacy Considerations</a> could also be considered to affect Security.</p> </main> <h2 class="no-ref no-num heading settled" id="w3c-conformance"><span class="content"> Conformance</span><a class="self-link" href="#w3c-conformance"></a></h2> <h3 class="no-ref heading settled" id="w3c-conventions"><span class="content"> Document conventions</span><a class="self-link" href="#w3c-conventions"></a></h3> <p>Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification. </p> <p>All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. <a data-link-type="biblio" href="#biblio-rfc2119" title="Key words for use in RFCs to Indicate Requirement Levels">[RFC2119]</a></p> <p>Examples in this specification are introduced with the words “for example” or are set apart from the normative text with <code>class="example"</code>, like this: </p> <div class="example" id="w3c-example"> <a class="self-link" href="#w3c-example"></a> <p>This is an example of an informative example.</p> </div> <p>Informative notes begin with the word “Note” and are set apart from the normative text with <code>class="note"</code>, like this: </p> <p class="note" role="note">Note, this is an informative note.</p> <p>Advisements are normative sections styled to evoke special attention and are set apart from other normative text with <code><strong class="advisement"></code>, like this: <strong class="advisement"> UAs MUST provide an accessible alternative. </strong></p> <details class="wpt-tests-block" dir="ltr" lang="en" open> <summary>Tests</summary> <p>Tests relating to the content of this specification may be documented in “Tests” blocks like this one. Any such block is non-normative.</p> <ul class="wpt-tests-list"></ul> <hr> </details> <h3 class="no-ref heading settled" id="w3c-conformance-classes"><span class="content"> Conformance classes</span><a class="self-link" href="#w3c-conformance-classes"></a></h3> <p>Conformance to this specification is defined for three conformance classes: </p> <dl> <dt>style sheet <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS style sheet</a>. <dt>renderer <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a> that interprets the semantics of a style sheet and renders documents that use them. <dt>authoring tool <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a> that writes a style sheet. </dl> <p>A style sheet is conformant to this specification if all of its statements that use syntax defined in this module are valid according to the generic CSS grammar and the individual grammars of each feature defined in this module. </p> <p>A renderer is conformant to this specification if, in addition to interpreting the style sheet as defined by the appropriate specifications, it supports all the features defined by this specification by parsing them correctly and rendering the document accordingly. However, the inability of a UA to correctly render a document due to limitations of the device does not make the UA non-conformant. (For example, a UA is not required to render color on a monochrome monitor.) </p> <p>An authoring tool is conformant to this specification if it writes style sheets that are syntactically correct according to the generic CSS grammar and the individual grammars of each feature in this module, and meet all other conformance requirements of style sheets as described in this module. </p> <h3 class="no-ref heading settled" id="w3c-partial"><span class="content"> Partial implementations</span><a class="self-link" href="#w3c-partial"></a></h3> <p>So that authors can exploit the forward-compatible parsing rules to assign fallback values, CSS renderers <strong>must</strong> treat as invalid (and <a href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignore as appropriate</a>) any at-rules, properties, property values, keywords, and other syntactic constructs for which they have no usable level of support. In particular, user agents <strong>must not</strong> selectively ignore unsupported component values and honor supported values in a single multi-value property declaration: if any value is considered invalid (as unsupported values must be), CSS requires that the entire declaration be ignored.</p> <h4 class="heading settled" id="w3c-conform-future-proofing"><span class="content"> Implementations of Unstable and Proprietary Features</span><a class="self-link" href="#w3c-conform-future-proofing"></a></h4> <p>To avoid clashes with future stable CSS features, the CSSWG recommends <a href="http://www.w3.org/TR/CSS/#future-proofing">following best practices</a> for the implementation of <a href="http://www.w3.org/TR/CSS/#unstable">unstable</a> features and <a href="http://www.w3.org/TR/CSS/#proprietary-extension">proprietary extensions</a> to CSS. </p> <h3 class="no-ref heading settled" id="w3c-testing"><span class="content"> Non-experimental implementations</span><a class="self-link" href="#w3c-testing"></a></h3> <p>Once a specification reaches the Candidate Recommendation stage, non-experimental implementations are possible, and implementors should release an unprefixed implementation of any CR-level feature they can demonstrate to be correctly implemented according to spec. </p> <p>To establish and maintain the interoperability of CSS across implementations, the CSS Working Group requests that non-experimental CSS renderers submit an implementation report (and, if necessary, the testcases used for that implementation report) to the W3C before releasing an unprefixed implementation of any CSS features. Testcases submitted to W3C are subject to review and correction by the CSS Working Group. </p> <p>Further information on submitting testcases and implementation reports can be found from on the CSS Working Group’s website at <a href="http://www.w3.org/Style/CSS/Test/">http://www.w3.org/Style/CSS/Test/</a>. Questions should be directed to the <a href="http://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a> mailing list.</p> <script src="https://www.w3.org/scripts/TR/2021/fixup.js"></script> <h2 class="no-num no-ref heading settled" id="index"><span class="content">Index</span><a class="self-link" href="#index"></a></h2> <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="content">Terms defined by this specification</span><a class="self-link" href="#index-defined-here"></a></h3> <ul class="index"> <li><a href="#selectordef-adjacent">+</a><span>, in § 15.3</span> <li><a href="#selectordef-child">></a><span>, in § 15.2</span> <li><a href="#selectordef-column">||</a><span>, in § 16.1</span> <li><a href="#selectordef-sibling">~</a><span>, in § 15.4</span> <li><a href="#active-pseudo">:active</a><span>, in § 9.2</span> <li><a href="#relative-selector-anchor-elements">anchor element</a><span>, in § 3.4</span> <li><a href="#any-link-pseudo">:any-link</a><span>, in § 8.1</span> <li><a href="#typedef-attribute-selector"><attribute-selector></a><span>, in § 18</span> <li><a href="#attribute-selector">attribute selector</a><span>, in § 6</span> <li><a href="#typedef-attr-matcher"><attr-matcher></a><span>, in § 18</span> <li><a href="#typedef-attr-modifier"><attr-modifier></a><span>, in § 18</span> <li><a href="#selectordef-autofill">:autofill</a><span>, in § 13.1.4</span> <li><a href="#blank-pseudo">:blank</a><span>, in § 13.3.1</span> <li><a href="#selectordef-buffering">:buffering</a><span>, in § 11.2</span> <li><a href="#checked-pseudo">:checked</a><span>, in § 13.2.1</span> <li><a href="#child-combinator">child combinator</a><span>, in § 15.2</span> <li><a href="#typedef-class-selector"><class-selector></a><span>, in § 18</span> <li><a href="#class-selector">class selector</a><span>, in § 6.6</span> <li><a href="#selectordef-closed">:closed</a><span>, in § 12.1</span> <li><a href="#column-combinator">column combinator</a><span>, in § 16.1</span> <li><a href="#typedef-combinator"><combinator></a><span>, in § 18</span> <li><a href="#selector-combinator">combinator</a><span>, in § 3.1</span> <li><a href="#typedef-complex-real-selector"><complex-real-selector></a><span>, in § 18</span> <li><a href="#typedef-complex-real-selector-list"><complex-real-selector-list></a><span>, in § 18</span> <li><a href="#typedef-complex-selector"><complex-selector></a><span>, in § 18</span> <li><a href="#complex">complex selector</a><span>, in § 3.1</span> <li><a href="#typedef-complex-selector-list"><complex-selector-list></a><span>, in § 18</span> <li><a href="#typedef-complex-selector-unit"><complex-selector-unit></a><span>, in § 18</span> <li><a href="#typedef-compound-selector"><compound-selector></a><span>, in § 18</span> <li><a href="#compound">compound selector</a><span>, in § 3.1</span> <li><a href="#typedef-compound-selector-list"><compound-selector-list></a><span>, in § 18</span> <li><a href="#current-pseudo">:current</a><span>, in § 10.1</span> <li><a href="#selectordef-current">:current()</a><span>, in § 10.1</span> <li><a href="#nsdecl">declared</a><span>, in § 3.8</span> <li><a href="#default-pseudo">:default</a><span>, in § 13.1.5</span> <li><a href="#defined-pseudo">:defined</a><span>, in § 5.4</span> <li><a href="#descendant-combinator">descendant combinator</a><span>, in § 15.1</span> <li><a href="#dir-pseudo">:dir()</a><span>, in § 7.1</span> <li><a href="#disabled-pseudo">:disabled</a><span>, in § 13.1.1</span> <li><a href="#document-language">document language</a><span>, in § 3.2</span> <li><a href="#empty-pseudo">:empty</a><span>, in § 14.2</span> <li><a href="#enabled-pseudo">:enabled</a><span>, in § 13.1.1</span> <li><a href="#evaluating-selectors">evaluating a selector</a><span>, in § 20.4</span> <li><a href="#featureless">featureless</a><span>, in § 3.2.1</span> <li><a href="#first-child-pseudo">:first-child</a><span>, in § 14.3.3</span> <li><a href="#first-of-type-pseudo">:first-of-type</a><span>, in § 14.4.3</span> <li><a href="#focus-pseudo">:focus</a><span>, in § 9.3</span> <li><a href="#focus-visible-pseudo">:focus-visible</a><span>, in § 9.4</span> <li><a href="#focus-within-pseudo">:focus-within</a><span>, in § 9.5</span> <li><a href="#typedef-forgiving-selector-list"><forgiving-selector-list></a><span>, in § 18.1</span> <li><a href="#selectordef-fullscreen">:fullscreen</a><span>, in § 12.3</span> <li><a href="#functional-pseudo-class">functional pseudo-class</a><span>, in § 3.5</span> <li><a href="#functional-pseudo-element">functional pseudo-element</a><span>, in § 3.6.1</span> <li><a href="#future-pseudo">:future</a><span>, in § 10.3</span> <li><a href="#has-pseudo">:has()</a><span>, in § 4.5</span> <li><a href="#has-allowed-pseudo-element">:has-allowed pseudo-element</a><span>, in § 4.5</span> <li><a href="#host-language">host language</a><span>, in § 3.2</span> <li><a href="#hover-pseudo">:hover</a><span>, in § 9.1</span> <li><a href="#typedef-id-selector"><id-selector></a><span>, in § 18</span> <li><a href="#id-selector">ID selector</a><span>, in § 6.7</span> <li><a href="#indeterminate-pseudo">:indeterminate</a><span>, in § 13.2.2</span> <li><a href="#indicate-focus">indicate focus</a><span>, in § 9.4</span> <li><a href="#in-range-pseudo">:in-range</a><span>, in § 13.3.3</span> <li><a href="#invalid-pseudo">:invalid</a><span>, in § 13.3.2</span> <li><a href="#invalid-selector">invalid</a><span>, in § 3.9</span> <li><a href="#invalid-selector">invalid selector</a><span>, in § 3.9</span> <li><a href="#matches-pseudo">:is()</a><span>, in § 4.2</span> <li><a href="#lang-pseudo">:lang()</a><span>, in § 7.2</span> <li><a href="#language-range">language range</a><span>, in § 7.2</span> <li><a href="#last-child-pseudo">:last-child</a><span>, in § 14.3.4</span> <li><a href="#last-of-type-pseudo">:last-of-type</a><span>, in § 14.4.4</span> <li><a href="#typedef-legacy-pseudo-element-selector"><legacy-pseudo-element-selector></a><span>, in § 18</span> <li><a href="#legacy-selector-alias">legacy selector alias</a><span>, in § 3.10</span> <li><a href="#link-pseudo">:link</a><span>, in § 8.2</span> <li><a href="#list-of-simple-selectors">list of complex selectors</a><span>, in § 3.1</span> <li><a href="#list-of-simple-selectors">list of compound selectors</a><span>, in § 3.1</span> <li><a href="#selector-list">list of selectors</a><span>, in § 3.1</span> <li><a href="#list-of-simple-selectors">list of simple selectors</a><span>, in § 3.1</span> <li><a href="#local-link-pseudo">:local-link</a><span>, in § 8.3</span> <li><a href="#logical-combination-pseudo-classes">logical combination pseudo-classes</a><span>, in § 4</span> <li><a href="#match">match</a><span>, in § 3.1</span> <li><a href="#match-a-complex-selector-against-an-element">match a complex selector against an element</a><span>, in § 19.3</span> <li><a href="#match-a-selector-against-an-element">match a selector against an element</a><span>, in § 19.3</span> <li><a href="#match-a-selector-against-a-pseudo-element">match a selector against a pseudo-element</a><span>, in § 19.4</span> <li><a href="#match-a-selector-against-a-tree">match a selector against a tree</a><span>, in § 19.5</span> <li><a href="#selectordef-matches">:matches()</a><span>, in § 4.2</span> <li><a href="#selectordef-modal">:modal</a><span>, in § 12.2</span> <li><a href="#selectordef-muted">:muted</a><span>, in § 11.3</span> <li><a href="#next-sibling-combinator">next-sibling combinator</a><span>, in § 15.3</span> <li><a href="#negation-pseudo">:not()</a><span>, in § 4.3</span> <li><a href="#typedef-ns-prefix"><ns-prefix></a><span>, in § 18</span> <li><a href="#nth-child-pseudo">:nth-child()</a><span>, in § 14.3.1</span> <li><a href="#nth-col-pseudo">:nth-col()</a><span>, in § 16.2</span> <li><a href="#nth-last-child-pseudo">:nth-last-child()</a><span>, in § 14.3.2</span> <li><a href="#nth-last-col-pseudo">:nth-last-col()</a><span>, in § 16.3</span> <li><a href="#nth-last-of-type-pseudo">:nth-last-of-type()</a><span>, in § 14.4.2</span> <li><a href="#nth-of-type-pseudo">:nth-of-type()</a><span>, in § 14.4.1</span> <li><a href="#only-child-pseudo">:only-child</a><span>, in § 14.3.5</span> <li><a href="#only-of-type-pseudo">:only-of-type</a><span>, in § 14.4.5</span> <li><a href="#selectordef-open">:open</a><span>, in § 12.1</span> <li><a href="#optional-pseudo">:optional</a><span>, in § 13.3.4</span> <li><a href="#originating-element">originating element</a><span>, in § 3.6.2</span> <li><a href="#originating-pseudo-element">originating pseudo-element</a><span>, in § 3.6.4</span> <li><a href="#out-of-range-pseudo">:out-of-range</a><span>, in § 13.3.3</span> <li><a href="#parse-a-relative-selector">parse a relative selector</a><span>, in § 19.2</span> <li><a href="#parse-as-a-forgiving-selector-list">parse as a forgiving selector list</a><span>, in § 18.1</span> <li><a href="#parse-a-selector">parse a selector</a><span>, in § 19.1</span> <li><a href="#past-pseudo">:past</a><span>, in § 10.2</span> <li><a href="#selectordef-paused">:paused</a><span>, in § 11.1</span> <li><a href="#selectordef-picture-in-picture">:picture-in-picture</a><span>, in § 12.4</span> <li><a href="#placeholder-shown-pseudo">:placeholder-shown</a><span>, in § 13.1.3</span> <li><a href="#selectordef-playing">:playing</a><span>, in § 11.1</span> <li><a href="#pseudo-class">pseudo-class</a><span>, in § 3.5</span> <li><a href="#typedef-pseudo-class-selector"><pseudo-class-selector></a><span>, in § 18</span> <li><a href="#typedef-pseudo-compound-selector"><pseudo-compound-selector></a><span>, in § 18</span> <li><a href="#pseudo-compound">pseudo-compound selector</a><span>, in § 3.1</span> <li><a href="#pseudo-element">pseudo-element</a><span>, in § 3.6</span> <li><a href="#typedef-pseudo-element-selector"><pseudo-element-selector></a><span>, in § 18</span> <li><a href="#read-only-pseudo">:read-only</a><span>, in § 13.1.2</span> <li><a href="#read-write-pseudo">:read-write</a><span>, in § 13.1.2</span> <li><a href="#relative-selector">relative</a><span>, in § 3.4</span> <li><a href="#typedef-relative-real-selector"><relative-real-selector></a><span>, in § 18</span> <li><a href="#typedef-relative-real-selector-list"><relative-real-selector-list></a><span>, in § 18</span> <li><a href="#typedef-relative-selector"><relative-selector></a><span>, in § 18</span> <li><a href="#relative-selector">relative selector</a><span>, in § 3.4</span> <li><a href="#relative-selector-anchor-elements">relative selector anchor elements</a><span>, in § 3.4</span> <li><a href="#typedef-relative-selector-list"><relative-selector-list></a><span>, in § 18</span> <li><a href="#required-pseudo">:required</a><span>, in § 13.3.4</span> <li><a href="#root-pseudo">:root</a><span>, in § 14.1</span> <li><a href="#scope-pseudo">:scope</a><span>, in § 8.6</span> <li><a href="#scoped-selector">scope</a><span>, in § 3.3</span> <li><a href="#scoped-selector">scoped selector</a><span>, in § 3.3</span> <li><a href="#scoping-root">scoping root</a><span>, in § 3.3</span> <li><a href="#selectordef-seeking">:seeking</a><span>, in § 11.1</span> <li><a href="#selector">selector</a><span>, in § 3.1</span> <li><a href="#typedef-selector-list"><selector-list></a><span>, in § 18</span> <li><a href="#selector-list">selector list</a><span>, in § 3.1</span> <li><a href="#typedef-simple-selector"><simple-selector></a><span>, in § 18</span> <li><a href="#simple">simple selector</a><span>, in § 3.1</span> <li><a href="#typedef-simple-selector-list"><simple-selector-list></a><span>, in § 18</span> <li><a href="#specificity">specificity</a><span>, in § 17</span> <li><a href="#selectordef-stalled">:stalled</a><span>, in § 11.2</span> <li><a href="#structural-pseudo-classes">structural pseudo-classes</a><span>, in § 14</span> <li><a href="#typedef-subclass-selector"><subclass-selector></a><span>, in § 18</span> <li><a href="#selector-subject">subject</a><span>, in § 3.1</span> <li><a href="#selector-subject">subject of a selector</a><span>, in § 3.1</span> <li><a href="#selector-subject">subject of the selector</a><span>, in § 3.1</span> <li><a href="#sub-pseudo-element">sub-pseudo-element</a><span>, in § 3.6.4</span> <li><a href="#subsequent-sibling-combinator">subsequent-sibling combinator</a><span>, in § 15.4</span> <li><a href="#target-pseudo">:target</a><span>, in § 8.4</span> <li><a href="#target-within-pseudo">:target-within</a><span>, in § 8.5</span> <li><a href="#typedef-type-selector"><type-selector></a><span>, in § 18</span> <li><a href="#type-selector">type selector</a><span>, in § 5.1</span> <li><a href="#ultimate-originating-element">ultimate originating element</a><span>, in § 3.6.4</span> <li><a href="#universal-selector">universal selector</a><span>, in § 5.2</span> <li><a href="#unknown--webkit--pseudo-elements">unknown -webkit- pseudo-elements</a><span>, in § Unnumbered section</span> <li><a href="#user-action-pseudo-class">user action pseudo-class</a><span>, in § 9</span> <li><a href="#user-invalid-pseudo">:user-invalid</a><span>, in § 13.3.5</span> <li><a href="#user-valid-pseudo">:user-valid</a><span>, in § 13.3.5</span> <li><a href="#valid-pseudo">:valid</a><span>, in § 13.3.2</span> <li><a href="#visited-pseudo">:visited</a><span>, in § 8.2</span> <li><a href="#selectordef-volume-locked">:volume-locked</a><span>, in § 11.3</span> <li><a href="#where-pseudo">:where()</a><span>, in § 4.4</span> <li><a href="#whitespace">White space</a><span>, in § 3.7</span> <li><a href="#typedef-wq-name"><wq-name></a><span>, in § 18</span> </ul> <h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span class="content">Terms defined by reference</span><a class="self-link" href="#index-defined-elsewhere"></a></h3> <ul class="index"> <li> <a data-link-type="biblio">[CSS-COLOR-5]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="9ffb0043">a</span> </ul> <li> <a data-link-type="biblio">[CSS-DISPLAY-3]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="0e9419b9">display</span> </ul> <li> <a data-link-type="biblio">[CSS-DISPLAY-4]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="df19338c">box tree</span> <li><span class="dfn-paneled" id="09cd65e4">display type</span> <li><span class="dfn-paneled" id="96626f55">list-item</span> <li><span class="dfn-paneled" id="12f8fb07">visibility</span> </ul> <li> <a data-link-type="biblio">[CSS-MULTICOL-2]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="e515eec3">::column</span> </ul> <li> <a data-link-type="biblio">[CSS-PSEUDO-4]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="fd0c9e35">::after</span> <li><span class="dfn-paneled" id="5869f885">::before</span> <li><span class="dfn-paneled" id="a1addf6c">::first-letter</span> <li><span class="dfn-paneled" id="75bfa627">::first-line</span> <li><span class="dfn-paneled" id="5875aeb9">::marker</span> <li><span class="dfn-paneled" id="b54af98a">tree-abiding</span> <li><span class="dfn-paneled" id="16a52cab">tree-abiding pseudo-elements</span> </ul> <li> <a data-link-type="biblio">[CSS-SCOPING-1]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="a658d30c">::shadow</span> <li><span class="dfn-paneled" id="c90d9be6">::slotted()</span> <li><span class="dfn-paneled" id="b8e482b4">:host</span> <li><span class="dfn-paneled" id="6f539384">:host-context()</span> <li><span class="dfn-paneled" id="22109b0e">flat tree</span> </ul> <li> <a data-link-type="biblio">[CSS-TEXT-4]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="5879b11d">content language</span> <li><span class="dfn-paneled" id="a963f9ba">document white space characters</span> </ul> <li> <a data-link-type="biblio">[CSS-VALUES-4]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="08eba280">!</span> <li><span class="dfn-paneled" id="68487d22">#</span> <li><span class="dfn-paneled" id="68150e76">*</span> <li><span class="dfn-paneled" id="9213678e"><ident></span> <li><span class="dfn-paneled" id="977d3003"><string></span> <li><span class="dfn-paneled" id="537cf076">?</span> <li><span class="dfn-paneled" id="9dc6ce48">identifier</span> <li><span class="dfn-paneled" id="6ec67710">|</span> </ul> <li> <a data-link-type="biblio">[CSS-WRITING-MODES-3]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="5bc8bd12">direction</span> </ul> <li> <a data-link-type="biblio">[CSS22]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="74a27486">:before</span> </ul> <li> <a data-link-type="biblio">[CSS3NAMESPACE]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="bf0e8186">@namespace</span> <li><span class="dfn-paneled" id="ee301461">CSS qualified name</span> <li><span class="dfn-paneled" id="de39d615">default namespace</span> </ul> <li> <a data-link-type="biblio">[CSS3SYN]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="3a098985"><an+b></span> <li><span class="dfn-paneled" id="8716d04f"><any-value></span> <li><span class="dfn-paneled" id="af50aa62"><function-token></span> <li><span class="dfn-paneled" id="0190963b"><hash-token></span> <li><span class="dfn-paneled" id="07308da5"><ident-token></span> <li><span class="dfn-paneled" id="6158d44a"><string-token></span> <li><span class="dfn-paneled" id="76c4403d">parse</span> <li><span class="dfn-paneled" id="ca0abe12">parse a list</span> </ul> <li> <a data-link-type="biblio">[DOM]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="49a2843d">DocumentFragment</span> <li><span class="dfn-paneled" id="da8b8e0e">descendant</span> <li><span class="dfn-paneled" id="2f0ba72c">document element</span> <li><span class="dfn-paneled" id="8bc6d766">inclusive sibling</span> <li><span class="dfn-paneled" id="6f0f52dc">parentNode</span> <li><span class="dfn-paneled" id="fd11cdcd">quirks mode</span> <li><span class="dfn-paneled" id="f7960529">root</span> <li><span class="dfn-paneled" id="58a8f724">shadow host</span> <li><span class="dfn-paneled" id="19f9e9df">shadow tree</span> <li><span class="dfn-paneled" id="fefa5851">shadow-including tree order</span> <li><span class="dfn-paneled" id="e6cc3311">tree</span> </ul> <li> <a data-link-type="biblio">[FULLSCREEN]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="bcdb6841">requestFullscreen()</span> </ul> <li> <a data-link-type="biblio">[HTML]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="d056461c">:user-invalid</span> <li><span class="dfn-paneled" id="68bf3d31">a</span> <li><span class="dfn-paneled" id="a1a807e5">area</span> <li><span class="dfn-paneled" id="2c82d279">audio</span> <li><span class="dfn-paneled" id="bfff6250">button</span> <li><span class="dfn-paneled" id="b6fb7a51">custom element</span> <li><span class="dfn-paneled" id="1748bbeb">details</span> <li><span class="dfn-paneled" id="1812300f">dialog</span> <li><span class="dfn-paneled" id="a7bbaf9f">div</span> <li><span class="dfn-paneled" id="28c097f8">effective media volume</span> <li><span class="dfn-paneled" id="da60253e">element definition</span> <li><span class="dfn-paneled" id="7992f81d">em</span> <li><span class="dfn-paneled" id="7a348049">h1</span> <li><span class="dfn-paneled" id="ca0c892d">href</span> <li><span class="dfn-paneled" id="c3dd181e">html</span> <li><span class="dfn-paneled" id="f0811ff8">img</span> <li><span class="dfn-paneled" id="d7d642a2">input</span> <li><span class="dfn-paneled" id="84f243ef">label</span> <li><span class="dfn-paneled" id="7486f2c8">li</span> <li><span class="dfn-paneled" id="0027e642">media data</span> <li><span class="dfn-paneled" id="b2198f14">media element stall timeout</span> <li><span class="dfn-paneled" id="64b89595">meta</span> <li><span class="dfn-paneled" id="655fdd86">muted</span> <li><span class="dfn-paneled" id="99b5cef6">object</span> <li><span class="dfn-paneled" id="f29863d8">ol</span> <li><span class="dfn-paneled" id="b80d76a2">p</span> <li><span class="dfn-paneled" id="b9a05383">placeholder</span> <li><span class="dfn-paneled" id="22a0e026">pre</span> <li><span class="dfn-paneled" id="9dc3e09f">q</span> <li><span class="dfn-paneled" id="85188fb3">select</span> <li><span class="dfn-paneled" id="9d861566">showModal()</span> <li><span class="dfn-paneled" id="b32b852a">span</span> <li><span class="dfn-paneled" id="fc736137">textarea</span> <li><span class="dfn-paneled" id="aa7bbf63">video</span> </ul> <li> <a data-link-type="biblio">[INFRA]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="7f9469b5">ASCII case-insensitive</span> <li><span class="dfn-paneled" id="91c016b5">identical to</span> </ul> <li> <a data-link-type="biblio">[MATHML-CORE]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="5f4f7d1c">math</span> </ul> <li> <a data-link-type="biblio">[SELECT]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="53a193f1">*</span> </ul> <li> <a data-link-type="biblio">[SELECTORS-4]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="877c1491"><forgiving-relative-selector-list></span> </ul> <li> <a data-link-type="biblio">[URL]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="ed948033">fragment</span> </ul> </ul> <h2 class="no-num no-ref heading settled" id="references"><span class="content">References</span><a class="self-link" href="#references"></a></h2> <h3 class="no-num no-ref heading settled" id="normative"><span class="content">Normative References</span><a class="self-link" href="#normative"></a></h3> <dl> <dt id="biblio-bcp47">[BCP47] <dd>A. Phillips, Ed.; M. Davis, Ed.. <a href="https://www.rfc-editor.org/rfc/rfc5646"><cite>Tags for Identifying Languages</cite></a>. September 2009. Best Current Practice. URL: <a href="https://www.rfc-editor.org/rfc/rfc5646">https://www.rfc-editor.org/rfc/rfc5646</a> <dt id="biblio-css-display-4">[CSS-DISPLAY-4] <dd><a href="https://drafts.csswg.org/css-display-4/"><cite>CSS Display Module Level 4</cite></a>. Editor's Draft. URL: <a href="https://drafts.csswg.org/css-display-4/">https://drafts.csswg.org/css-display-4/</a> <dt id="biblio-css-multicol-2">[CSS-MULTICOL-2] <dd><a href="https://drafts.csswg.org/css-multicol-2/"><cite>CSS Multi-column Layout Module Level 2</cite></a>. Editor's Draft. URL: <a href="https://drafts.csswg.org/css-multicol-2/">https://drafts.csswg.org/css-multicol-2/</a> <dt id="biblio-css-pseudo-4">[CSS-PSEUDO-4] <dd>Daniel Glazman; Elika Etemad; Alan Stearns. <a href="https://drafts.csswg.org/css-pseudo-4/"><cite>CSS Pseudo-Elements Module Level 4</cite></a>. URL: <a href="https://drafts.csswg.org/css-pseudo-4/">https://drafts.csswg.org/css-pseudo-4/</a> <dt id="biblio-css-scoping-1">[CSS-SCOPING-1] <dd>Tab Atkins Jr.; Elika Etemad. <a href="https://drafts.csswg.org/css-scoping/"><cite>CSS Scoping Module Level 1</cite></a>. URL: <a href="https://drafts.csswg.org/css-scoping/">https://drafts.csswg.org/css-scoping/</a> <dt id="biblio-css-text-4">[CSS-TEXT-4] <dd>Elika Etemad; et al. <a href="https://drafts.csswg.org/css-text-4/"><cite>CSS Text Module Level 4</cite></a>. URL: <a href="https://drafts.csswg.org/css-text-4/">https://drafts.csswg.org/css-text-4/</a> <dt id="biblio-css-values-4">[CSS-VALUES-4] <dd>Tab Atkins Jr.; Elika Etemad. <a href="https://drafts.csswg.org/css-values-4/"><cite>CSS Values and Units Module Level 4</cite></a>. URL: <a href="https://drafts.csswg.org/css-values-4/">https://drafts.csswg.org/css-values-4/</a> <dt id="biblio-css-writing-modes-3">[CSS-WRITING-MODES-3] <dd>Elika Etemad; Koji Ishii. <a href="https://drafts.csswg.org/css-writing-modes-3/"><cite>CSS Writing Modes Level 3</cite></a>. URL: <a href="https://drafts.csswg.org/css-writing-modes-3/">https://drafts.csswg.org/css-writing-modes-3/</a> <dt id="biblio-css21">[CSS21] <dd>Bert Bos; et al. <a href="https://drafts.csswg.org/css2/"><cite>Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification</cite></a>. URL: <a href="https://drafts.csswg.org/css2/">https://drafts.csswg.org/css2/</a> <dt id="biblio-css22">[CSS22] <dd>Bert Bos. <a href="https://drafts.csswg.org/css2/"><cite>Cascading Style Sheets Level 2 Revision 2 (CSS 2.2) Specification</cite></a>. URL: <a href="https://drafts.csswg.org/css2/">https://drafts.csswg.org/css2/</a> <dt id="biblio-css3namespace">[CSS3NAMESPACE] <dd>Elika Etemad. <a href="https://drafts.csswg.org/css-namespaces/"><cite>CSS Namespaces Module Level 3</cite></a>. URL: <a href="https://drafts.csswg.org/css-namespaces/">https://drafts.csswg.org/css-namespaces/</a> <dt id="biblio-css3syn">[CSS3SYN] <dd>Tab Atkins Jr.; Simon Sapin. <a href="https://drafts.csswg.org/css-syntax/"><cite>CSS Syntax Module Level 3</cite></a>. URL: <a href="https://drafts.csswg.org/css-syntax/">https://drafts.csswg.org/css-syntax/</a> <dt id="biblio-dom">[DOM] <dd>Anne van Kesteren. <a href="https://dom.spec.whatwg.org/"><cite>DOM Standard</cite></a>. Living Standard. URL: <a href="https://dom.spec.whatwg.org/">https://dom.spec.whatwg.org/</a> <dt id="biblio-html">[HTML] <dd>Anne van Kesteren; et al. <a href="https://html.spec.whatwg.org/multipage/"><cite>HTML Standard</cite></a>. Living Standard. URL: <a href="https://html.spec.whatwg.org/multipage/">https://html.spec.whatwg.org/multipage/</a> <dt id="biblio-infra">[INFRA] <dd>Anne van Kesteren; Domenic Denicola. <a href="https://infra.spec.whatwg.org/"><cite>Infra Standard</cite></a>. Living Standard. URL: <a href="https://infra.spec.whatwg.org/">https://infra.spec.whatwg.org/</a> <dt id="biblio-rfc2119">[RFC2119] <dd>S. Bradner. <a href="https://datatracker.ietf.org/doc/html/rfc2119"><cite>Key words for use in RFCs to Indicate Requirement Levels</cite></a>. March 1997. Best Current Practice. URL: <a href="https://datatracker.ietf.org/doc/html/rfc2119">https://datatracker.ietf.org/doc/html/rfc2119</a> <dt id="biblio-rfc4647">[RFC4647] <dd>A. Phillips, Ed.; M. Davis, Ed.. <a href="https://www.rfc-editor.org/rfc/rfc4647"><cite>Matching of Language Tags</cite></a>. September 2006. Best Current Practice. URL: <a href="https://www.rfc-editor.org/rfc/rfc4647">https://www.rfc-editor.org/rfc/rfc4647</a> <dt id="biblio-select">[SELECT] <dd>Tantek Çelik; et al. <a href="https://drafts.csswg.org/selectors-3/"><cite>Selectors Level 3</cite></a>. URL: <a href="https://drafts.csswg.org/selectors-3/">https://drafts.csswg.org/selectors-3/</a> <dt id="biblio-selectors-4">[SELECTORS-4] <dd>Elika Etemad; Tab Atkins Jr.. <a href="https://drafts.csswg.org/selectors/"><cite>Selectors Level 4</cite></a>. URL: <a href="https://drafts.csswg.org/selectors/">https://drafts.csswg.org/selectors/</a> <dt id="biblio-url">[URL] <dd>Anne van Kesteren. <a href="https://url.spec.whatwg.org/"><cite>URL Standard</cite></a>. Living Standard. URL: <a href="https://url.spec.whatwg.org/">https://url.spec.whatwg.org/</a> </dl> <h3 class="no-num no-ref heading settled" id="informative"><span class="content">Informative References</span><a class="self-link" href="#informative"></a></h3> <dl> <dt id="biblio-css-color-5">[CSS-COLOR-5] <dd>Chris Lilley; et al. <a href="https://drafts.csswg.org/css-color-5/"><cite>CSS Color Module Level 5</cite></a>. URL: <a href="https://drafts.csswg.org/css-color-5/">https://drafts.csswg.org/css-color-5/</a> <dt id="biblio-css-display-3">[CSS-DISPLAY-3] <dd>Elika Etemad; Tab Atkins Jr.. <a href="https://drafts.csswg.org/css-display/"><cite>CSS Display Module Level 3</cite></a>. URL: <a href="https://drafts.csswg.org/css-display/">https://drafts.csswg.org/css-display/</a> <dt id="biblio-css3ui">[CSS3UI] <dd>Tantek Çelik; Florian Rivoal. <a href="https://drafts.csswg.org/css-ui-3/"><cite>CSS Basic User Interface Module Level 3 (CSS3 UI)</cite></a>. URL: <a href="https://drafts.csswg.org/css-ui-3/">https://drafts.csswg.org/css-ui-3/</a> <dt id="biblio-cssstyleattr">[CSSSTYLEATTR] <dd>Tantek Çelik; Elika Etemad. <a href="https://drafts.csswg.org/css-style-attr/"><cite>CSS Style Attributes</cite></a>. URL: <a href="https://drafts.csswg.org/css-style-attr/">https://drafts.csswg.org/css-style-attr/</a> <dt id="biblio-fullscreen">[FULLSCREEN] <dd>Philip Jägenstedt. <a href="https://fullscreen.spec.whatwg.org/"><cite>Fullscreen API Standard</cite></a>. Living Standard. URL: <a href="https://fullscreen.spec.whatwg.org/">https://fullscreen.spec.whatwg.org/</a> <dt id="biblio-html5">[HTML5] <dd>Ian Hickson; et al. <a href="https://www.w3.org/TR/html5/"><cite>HTML5</cite></a>. 27 March 2018. REC. URL: <a href="https://www.w3.org/TR/html5/">https://www.w3.org/TR/html5/</a> <dt id="biblio-its20">[ITS20] <dd>David Filip; et al. <a href="https://www.w3.org/TR/its20/"><cite>Internationalization Tag Set (ITS) Version 2.0</cite></a>. 29 October 2013. REC. URL: <a href="https://www.w3.org/TR/its20/">https://www.w3.org/TR/its20/</a> <dt id="biblio-mathml">[MATHML] <dd>Patrick D F Ion; Robert R Miner. <a href="https://www.w3.org/TR/REC-MathML/"><cite>Mathematical Markup Language (MathML™) 1.01 Specification</cite></a>. 7 March 2023. REC. URL: <a href="https://www.w3.org/TR/REC-MathML/">https://www.w3.org/TR/REC-MathML/</a> <dt id="biblio-mathml-core">[MATHML-CORE] <dd>David Carlisle; Frédéric Wang. <a href="https://w3c.github.io/mathml-core/"><cite>MathML Core</cite></a>. URL: <a href="https://w3c.github.io/mathml-core/">https://w3c.github.io/mathml-core/</a> <dt id="biblio-picture-in-picture">[PICTURE-IN-PICTURE] <dd>Francois Beaufort. <a href="https://w3c.github.io/picture-in-picture/"><cite>Picture-in-Picture</cite></a>. URL: <a href="https://w3c.github.io/picture-in-picture/">https://w3c.github.io/picture-in-picture/</a> <dt id="biblio-quirks">[QUIRKS] <dd>Simon Pieters. <a href="https://quirks.spec.whatwg.org/"><cite>Quirks Mode Standard</cite></a>. Living Standard. URL: <a href="https://quirks.spec.whatwg.org/">https://quirks.spec.whatwg.org/</a> <dt id="biblio-svg11">[SVG11] <dd>Erik Dahlström; et al. <a href="https://www.w3.org/TR/SVG11/"><cite>Scalable Vector Graphics (SVG) 1.1 (Second Edition)</cite></a>. 16 August 2011. REC. URL: <a href="https://www.w3.org/TR/SVG11/">https://www.w3.org/TR/SVG11/</a> <dt id="biblio-xforms11">[XFORMS11] <dd>John Boyer. <a href="https://www.w3.org/TR/xforms11/"><cite>XForms 1.1</cite></a>. 20 October 2009. REC. URL: <a href="https://www.w3.org/TR/xforms11/">https://www.w3.org/TR/xforms11/</a> <dt id="biblio-xml-names">[XML-NAMES] <dd>Tim Bray; et al. <a href="https://www.w3.org/TR/xml-names/"><cite>Namespaces in XML 1.0 (Third Edition)</cite></a>. 8 December 2009. REC. URL: <a href="https://www.w3.org/TR/xml-names/">https://www.w3.org/TR/xml-names/</a> <dt id="biblio-xml10">[XML10] <dd>Tim Bray; et al. <a href="https://www.w3.org/TR/xml/"><cite>Extensible Markup Language (XML) 1.0 (Fifth Edition)</cite></a>. 26 November 2008. REC. URL: <a href="https://www.w3.org/TR/xml/">https://www.w3.org/TR/xml/</a> </dl> <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content">Issues Index</span><a class="self-link" href="#issues-index"></a></h2> <div style="counter-reset:issue"> <div class="issue">Add comma-separated syntax for <a href="http://lists.w3.org/Archives/Public/www-style/2011Mar/0215.html">multiple-value matching</a>? e.g. [rel ~= next, prev, up, first, last] <a class="issue-return" href="#issue-745ef775" title="Jump to section">↵</a></div> <div class="issue"> There’s a desire from authors to propagate <a class="css" data-link-type="maybe" href="#focus-pseudo">:focus</a> from a form control to its associated <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/forms.html#the-label-element">label</a></code> element; the main objection seems to be implementation difficulty. See <a href="https://github.com/w3c/csswg-drafts/issues/397">CSSWG issue (CSS)</a> and <a href="https://github.com/whatwg/html/issues/1632">WHATWG issue (HTML)</a>. <a class="issue-return" href="#issue-1416193e" title="Jump to section">↵</a></div> <div class="issue"> Are these still necessary now that we have more rigorous definitions for <a data-link-type="dfn" href="#match">match</a> and <a data-link-type="dfn" href="#invalid-selector">invalid selector</a>? Nouns are a lot easier to coordinate across specification than predicates, and details like the exact order of elements returned from <code>querySelector</code> seem to make more sense being defined in the DOM specification than in Selectors. <a class="issue-return" href="#issue-55d7bd68" title="Jump to section">↵</a></div> <div class="issue"> Only the <a data-link-type="dfn" href="https://drafts.csswg.org/css-pseudo-4/#tree-abiding">tree-abiding pseudo-elements</a> are really handled in any way remotely like this. <a class="issue-return" href="#issue-15f3317f" title="Jump to section">↵</a></div> <div class="issue"> The relative position of pseudo-elements in <var>selector match list</var> is undefined. There’s not yet a context that exposes this information, but we need to decide on something eventually, before something <em>is</em> exposed. <a class="issue-return" href="#issue-b7f52036" title="Jump to section">↵</a></div> <div class="issue"> Some pseudo-classes are *syntactical*, like <a class="css" data-link-type="maybe" href="#has-pseudo">:has()</a> and <a class="css" data-link-type="maybe" href="#matches-pseudo">:is()</a>, and thus should always work. Need to indicate that somewhere. Probably the structural pseudos always work whenever the child list is ordered. <a class="issue-return" href="#issue-772ec278" title="Jump to section">↵</a></div> <div class="issue"> Semantic definition should probably move back here. <a class="issue-return" href="#issue-fb60ae39" title="Jump to section">↵</a></div> <div class="issue"> Need to define tree for XML. <a class="issue-return" href="#issue-4ca3978c" title="Jump to section">↵</a></div> </div> <details class="mdn-anno unpositioned" data-anno-for="the-active-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:active" title="The :active CSS pseudo-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.">:active</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>4+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="adjacent-sibling-combinators"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Adjacent_sibling_combinator" title="The adjacent sibling combinator (+) separates two selectors and matches the second element only if it immediately follows the first element, and both are children of the same parent element.">Adjacent_sibling_combinator</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>3.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>7+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>37+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="the-any-link-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:any-link" title="The :any-link CSS pseudo-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.">:any-link</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>50+</span></span><span class="safari yes"><span>Safari</span><span>9+</span></span><span class="chrome yes"><span>Chrome</span><span>65+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios yes"><span>iOS Safari</span><span>9+</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>65+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="attribute-selectors"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors" title="The CSS attribute selector matches elements based on the element having a given attribute explicitly set, with options for defining an attribute value or substring value match.">Attribute_selectors</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>9+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>7+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios yes"><span>iOS Safari</span><span>1+</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>37+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="blank-pseudo"> <summary><b class="less-than-two-engines-flag" title="This feature is in less than two current engines.">⚠</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:blank" title="The :blank CSS pseudo-class selects empty user input elements (e.g. <input> or <textarea>).">:blank</a></p> <p class="less-than-two-engines-text">In no current engines.</p> <div class="support"> <span class="firefox no"><span>Firefox</span><span>None</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome no"><span>Chrome</span><span>None</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink no"><span>Edge</span><span>None</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="checked"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:checked" title="The :checked CSS pseudo-class selector represents any radio (<input type="radio">), checkbox (<input type="checkbox">), or option (<option> in a <select>) element that is checked or toggled to an on state.">:checked</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3.1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>9+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>9+</span></span> <hr> <span class="firefox_android yes"><span>Firefox for Android</span><span>4+</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android yes"><span>Chrome for Android</span><span>18+</span></span><span class="webview_android yes"><span>Android WebView</span><span>2+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="child-combinators"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Child_combinator" title="The child combinator (>) is placed between two CSS selectors. It matches only those elements matched by the second selector that are the direct children of elements matched by the first.">Child_combinator</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>4+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>7+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>37+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="class-html"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Class_selectors" title="The CSS class selector matches elements based on the contents of their class attribute.">Class_selectors</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>3.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>3+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>37+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="the-column-combinator"> <summary><b class="less-than-two-engines-flag" title="This feature is in less than two current engines.">⚠</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Column_combinator" title="The column combinator (||) is placed between two CSS selectors. It matches only those elements matched by the second selector that belong to the column elements matched by the first.">Column_combinator</a></p> <p class="less-than-two-engines-text">In no current engines.</p> <div class="support"> <span class="firefox no"><span>Firefox</span><span>None</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome no"><span>Chrome</span><span>None</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink no"><span>Edge</span><span>None</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="default-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:default" title="The :default CSS pseudo-class selects form elements that are the default in a group of related elements.">:default</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>4+</span></span><span class="safari yes"><span>Safari</span><span>5+</span></span><span class="chrome yes"><span>Chrome</span><span>10+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>10+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios yes"><span>iOS Safari</span><span>5+</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>37+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="descendant-combinators"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Descendant_combinator" title="The descendant combinator — typically represented by a single space (" ") character — combines two selectors such that elements matched by the second selector are selected if they have an ancestor (parent, parent's parent, parent's parent's parent, etc.) element matching the first selector. Selectors that utilize a descendant combinator are called descendant selectors.">Descendant_combinator</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>3.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>3+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="the-dir-pseudo"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:dir" title="The :dir() CSS pseudo-class matches elements based on the directionality of the text contained in them.">:dir</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>49+</span></span><span class="safari yes"><span>Safari</span><span>16.4+</span></span><span class="chrome no"><span>Chrome</span><span>None</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink no"><span>Edge</span><span>None</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="enableddisabled"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:disabled" title="The :disabled CSS pseudo-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.">:disabled</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3.1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>9+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>9+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>2+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:enabled" title="The :enabled CSS pseudo-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.">:enabled</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3.1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>9+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>9+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>2+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="the-empty-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:empty" title="The :empty CSS pseudo-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.">:empty</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3.1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>9.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>9+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>2+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="first-child-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:first-child" title="The :first-child CSS pseudo-class represents the first element among a group of sibling elements.">:first-child</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>3+</span></span><span class="safari yes"><span>Safari</span><span>3.1+</span></span><span class="chrome yes"><span>Chrome</span><span>4+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>9.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>7+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios yes"><span>iOS Safari</span><span>4+</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>37+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="first-of-type-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:first-of-type" title="The :first-of-type CSS pseudo-class represents the first element of its type among a group of sibling elements.">:first-of-type</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>3.5+</span></span><span class="safari yes"><span>Safari</span><span>3.1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>9.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>9+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>2+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="the-focus-visible-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible" title="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.)">:focus-visible</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>85+</span></span><span class="safari yes"><span>Safari</span><span>15.4+</span></span><span class="chrome yes"><span>Chrome</span><span>86+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>86+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="the-focus-within-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-within" title="The :focus-within CSS pseudo-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.)">:focus-within</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>52+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>60+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="focus-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:focus" title="The :focus CSS pseudo-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 Tab key.">:focus</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>7+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>8+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="the-future-pseudo"> <summary><b class="less-than-two-engines-flag" title="This feature is in less than two current engines.">⚠</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:future" title="The :future CSS pseudo-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.">:future</a></p> <p class="less-than-two-engines-text">In only one current engine.</p> <div class="support"> <span class="firefox no"><span>Firefox</span><span>None</span></span><span class="safari yes"><span>Safari</span><span>7+</span></span><span class="chrome no"><span>Chrome</span><span>None</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink no"><span>Edge</span><span>None</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="general-sibling-combinators"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/General_sibling_combinator" title="The general sibling combinator (~) separates two selectors and matches all iterations of the second element, that are following the first element (though not necessarily immediately), and are children of the same parent element.">General_sibling_combinator</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>9+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>7+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios yes"><span>iOS Safari</span><span>1+</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>37+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="relational"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:has" title="The functional :has() CSS pseudo-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.">:has</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span title="Requires setting a user preference or runtime flag.">🔰 103+</span></span><span class="safari yes"><span>Safari</span><span>15.4+</span></span><span class="chrome yes"><span>Chrome</span><span>105+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>105+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="the-hover-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:hover" title="The :hover CSS pseudo-class matches when the user interacts with an element with a pointing device, but does not necessarily activate it. It is generally triggered when the user hovers over an element with the cursor (mouse pointer).">:hover</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>2+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>4+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>4+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios yes"><span>iOS Safari</span><span>1+</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="id-selectors"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/ID_selectors" title="The CSS ID selector matches an element based on the value of the element's id attribute. In order for the element to be selected, its id attribute must match exactly the value given in the selector.">ID_selectors</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>3.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>3+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>37+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="in-range-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:in-range" title="The :in-range CSS pseudo-class represents an <input> element whose current value is within the range limits specified by the min and max attributes.">:in-range</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>29+</span></span><span class="safari yes"><span>Safari</span><span>5.1+</span></span><span class="chrome yes"><span>Chrome</span><span>10+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>11+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>13+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android yes"><span>Firefox for Android</span><span>16+</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>2.2+</span></span><span class="samsunginternet_android yes"><span>Samsung Internet</span><span>1.0+</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>11+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="indeterminate"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:indeterminate" title="The :indeterminate CSS pseudo-class represents any form element whose state is indeterminate, such as checkboxes which have their HTML indeterminate attribute set to true, radio buttons which are members of a group in which all radio buttons are unchecked, and indeterminate <progress> elements.">:indeterminate</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>2+</span></span><span class="safari yes"><span>Safari</span><span>3+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>9+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>10+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios yes"><span>iOS Safari</span><span>1+</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>37+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="validity-pseudos"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:invalid" title="The :invalid CSS pseudo-class represents any <form>, <fieldset>, <input> or other <form> element whose contents fail to validate.">:invalid</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>4+</span></span><span class="safari yes"><span>Safari</span><span>5+</span></span><span class="chrome yes"><span>Chrome</span><span>10+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>10+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>10+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios yes"><span>iOS Safari</span><span>5+</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>37+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:valid" title="The :valid CSS pseudo-class represents any <input> or other <form> element whose contents validate successfully. This allows to easily make valid fields adopt an appearance that helps the user confirm that their data is formatted properly.">:valid</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>4+</span></span><span class="safari yes"><span>Safari</span><span>5+</span></span><span class="chrome yes"><span>Chrome</span><span>10+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>10+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>10+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios yes"><span>iOS Safari</span><span>5+</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>37+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="matches-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:is" title="The :is() CSS pseudo-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.">:is</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>78+</span></span><span class="safari yes"><span>Safari</span><span>14+</span></span><span class="chrome yes"><span>Chrome</span><span>88+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>88+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios yes"><span>iOS Safari</span><span>14+</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>88+</span></span><span class="samsunginternet_android yes"><span>Samsung Internet</span><span>15.0+</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="lang-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:lang" title="The :lang() CSS pseudo-class matches elements based on the language they are determined to be in.">:lang</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3.1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>8+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>8+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="the-last-child-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:last-child" title="The :last-child CSS pseudo-class represents the last element among a group of sibling elements.">:last-child</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3.1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>9.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>9+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>37+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="last-of-type-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:last-of-type" title="The :last-of-type CSS pseudo-class represents the last element of its type among a group of sibling elements.">:last-of-type</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>3.5+</span></span><span class="safari yes"><span>Safari</span><span>3.1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>9.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>9+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>2+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="link"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:link" title="The :link CSS pseudo-class represents an element that has not yet been visited. It matches every unvisited <a> or <area> element that has an href attribute.">:link</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>3.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>3+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios yes"><span>iOS Safari</span><span>3.2+</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>1.5+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:visited" title="The :visited CSS pseudo-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 <a> and <area> elements that have an href attribute.">:visited</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>3.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>4+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="grouping"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Selector_list" title="The CSS selector list (,) selects all the matching nodes. A selector list is a comma-separated list of selectors.">Selector_list</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>3.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>3+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>37+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="modal-state"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:modal" title="The :modal CSS pseudo-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.">:modal</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>103+</span></span><span class="safari yes"><span>Safari</span><span>15.6+</span></span><span class="chrome yes"><span>Chrome</span><span>105+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>105+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="negation"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:not" title="The :not() CSS pseudo-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.">:not</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3.1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>9.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>9+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>2+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="nth-child-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child" title="The :nth-child() CSS pseudo-class matches elements based on their position among a group of siblings.">:nth-child</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>3.5+</span></span><span class="safari yes"><span>Safari</span><span>3.1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>9.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>9+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>37+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="nth-last-child-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-last-child" title="The :nth-last-child() CSS pseudo-class matches elements based on their position among a group of siblings, counting from the end.">:nth-last-child</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>3.5+</span></span><span class="safari yes"><span>Safari</span><span>3.1+</span></span><span class="chrome yes"><span>Chrome</span><span>4+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>9+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>9+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>37+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="nth-last-of-type-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-last-of-type" title="The :nth-last-of-type() CSS pseudo-class matches elements based on their position among siblings of the same type (tag name), counting from the end.">:nth-last-of-type</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>3.5+</span></span><span class="safari yes"><span>Safari</span><span>3.1+</span></span><span class="chrome yes"><span>Chrome</span><span>4+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>9.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>9+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>2+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="nth-of-type-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-of-type" title="The :nth-of-type() CSS pseudo-class matches elements based on their position among siblings of the same type (tag name).">:nth-of-type</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>3.5+</span></span><span class="safari yes"><span>Safari</span><span>3.1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>9.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>9+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>2+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="only-child-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:only-child" title="The :only-child CSS pseudo-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.">:only-child</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1.5+</span></span><span class="safari yes"><span>Safari</span><span>3.1+</span></span><span class="chrome yes"><span>Chrome</span><span>2+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>9.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>9+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>37+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="only-of-type-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:only-of-type" title="The :only-of-type CSS pseudo-class represents an element that has no siblings of the same type.">:only-of-type</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>3.5+</span></span><span class="safari yes"><span>Safari</span><span>3.1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>9.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>9+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>2+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="opt-pseudos"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:optional" title="The :optional CSS pseudo-class represents any <input>, <select>, or <textarea> element that does not have the required attribute set on it.">:optional</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>4+</span></span><span class="safari yes"><span>Safari</span><span>5+</span></span><span class="chrome yes"><span>Chrome</span><span>10+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>10+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>10+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios yes"><span>iOS Safari</span><span>5+</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>37+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:required" title="The :required CSS pseudo-class represents any <input>, <select>, or <textarea> element that has the required attribute set on it.">:required</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>4+</span></span><span class="safari yes"><span>Safari</span><span>5+</span></span><span class="chrome yes"><span>Chrome</span><span>10+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>10+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>10+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios yes"><span>iOS Safari</span><span>5+</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>4.4.3+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="out-of-range-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:out-of-range" title="The :out-of-range CSS pseudo-class represents an <input> element whose current value is outside the range limits specified by the min and max attributes.">:out-of-range</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>29+</span></span><span class="safari yes"><span>Safari</span><span>5.1+</span></span><span class="chrome yes"><span>Chrome</span><span>10+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>11+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>13+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android yes"><span>Firefox for Android</span><span>16+</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>2.2+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>11+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="the-past-pseudo"> <summary><b class="less-than-two-engines-flag" title="This feature is in less than two current engines.">⚠</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:past" title="The :past CSS pseudo-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.">:past</a></p> <p class="less-than-two-engines-text">In only one current engine.</p> <div class="support"> <span class="firefox no"><span>Firefox</span><span>None</span></span><span class="safari yes"><span>Safari</span><span>7+</span></span><span class="chrome no"><span>Chrome</span><span>None</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink no"><span>Edge</span><span>None</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="selectordef-paused"> <summary><b class="less-than-two-engines-flag" title="This feature is in less than two current engines.">⚠</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:paused" title="The :paused CSS pseudo-class selector represents an element that is playable, such as <audio> or <video>, when that element is "paused" (i.e. not "playing").">:paused</a></p> <p class="less-than-two-engines-text">In only one current engine.</p> <div class="support"> <span class="firefox no"><span>Firefox</span><span>None</span></span><span class="safari yes"><span>Safari</span><span>15.4+</span></span><span class="chrome no"><span>Chrome</span><span>None</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink no"><span>Edge</span><span>None</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="pip-state"> <summary><b class="less-than-two-engines-flag" title="This feature is in less than two current engines.">⚠</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:picture-in-picture" title="The :picture-in-picture CSS pseudo-class matches the element which is currently in picture-in-picture mode.">:picture-in-picture</a></p> <p class="less-than-two-engines-text">In only one current engine.</p> <div class="support"> <span class="firefox no"><span>Firefox</span><span>None</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span>110+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>110+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="placeholder"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:placeholder-shown" title="The :placeholder-shown CSS pseudo-class represents any <input> or <textarea> element that is currently displaying placeholder text.">:placeholder-shown</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>51+</span></span><span class="safari yes"><span>Safari</span><span>9+</span></span><span class="chrome yes"><span>Chrome</span><span>47+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="selectordef-playing"> <summary><b class="less-than-two-engines-flag" title="This feature is in less than two current engines.">⚠</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:playing" title="The :playing CSS pseudo-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).">:playing</a></p> <p class="less-than-two-engines-text">In only one current engine.</p> <div class="support"> <span class="firefox no"><span>Firefox</span><span>None</span></span><span class="safari yes"><span>Safari</span><span>15.4+</span></span><span class="chrome no"><span>Chrome</span><span>None</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink no"><span>Edge</span><span>None</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="rw-pseudos"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:read-only" title="The :read-only CSS pseudo-class represents an element (such as input or textarea) that is not editable by the user.">:read-only</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>78+</span></span><span class="safari yes"><span>Safari</span><span>4+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>9+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>13+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>None</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>37+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:read-write" title="The :read-write CSS pseudo-class represents an element (such as input or textarea) that is editable by the user.">:read-write</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>78+</span></span><span class="safari yes"><span>Safari</span><span>4+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>9+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>13+</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>None</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>37+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="root-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:root" title="The :root CSS pseudo-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 is higher.">:root</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>9.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>9+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>37+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="the-scope-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:scope" title="The :scope CSS pseudo-class represents elements that are a reference point, or scope, for selectors to match against.">:scope</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>32+</span></span><span class="safari yes"><span>Safari</span><span>7+</span></span><span class="chrome yes"><span>Chrome</span><span>27+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="the-target-within-pseudo"> <summary><b class="less-than-two-engines-flag" title="This feature is in less than two current engines.">⚠</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:target-within" title="The :target-within CSS pseudo-class represents an element that is a target element or contains an element that is a target. A target element is a unique element with an id matching the URL's fragment. In other words, it represents an element that is itself matched by the :target pseudo-class or has a descendant that is matched by :target. (This includes descendants in shadow trees.)">:target-within</a></p> <p class="less-than-two-engines-text">In no current engines.</p> <div class="support"> <span class="firefox no"><span>Firefox</span><span>None</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome no"><span>Chrome</span><span>None</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink no"><span>Edge</span><span>None</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="the-target-pseudo"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:target" title="The :target CSS pseudo-class represents a unique element (the target element) with an id matching the URL's fragment.">:target</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1.3+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>9.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>9+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios yes"><span>iOS Safari</span><span>2+</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>2+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="type-selectors"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Type_selectors" title="The CSS type selector matches elements by node name. In other words, it selects all elements of the given type within a document.">Type_selectors</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>3.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>3+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>37+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="the-universal-selector"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Universal_selectors" title="The CSS universal selector (*) matches elements of any type.">Universal_selectors</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span> <hr> <span class="opera yes"><span>Opera</span><span>3.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>IE</span><span>7+</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android yes"><span>Android WebView</span><span>37+</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>10.1+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="user-invalid-pseudo"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:user-invalid" title="The :user-invalid CSS pseudo-class represents any validated form element whose value isn't valid based on their validation constraints, after the user has interacted with it.">:user-invalid</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>88+</span></span><span class="safari yes"><span>Safari</span><span>16.5+</span></span><span class="chrome no"><span>Chrome</span><span>None</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink no"><span>Edge</span><span>None</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="user-valid-pseudo"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:user-valid" title="The :user-valid CSS pseudo-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.">:user-valid</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>88+</span></span><span class="safari yes"><span>Safari</span><span>16.5+</span></span><span class="chrome no"><span>Chrome</span><span>None</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink no"><span>Edge</span><span>None</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="zero-matches"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:where" title="The :where() CSS pseudo-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.">:where</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>78+</span></span><span class="safari yes"><span>Safari</span><span>14+</span></span><span class="chrome yes"><span>Chrome</span><span>88+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>88+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <script>/* Boilerplate: script-dom-helper */ "use strict"; function query(sel) { return document.querySelector(sel); } function queryAll(sel) { return [...document.querySelectorAll(sel)]; } function iter(obj) { if(!obj) return []; var it = obj[Symbol.iterator]; if(it) return it; return Object.entries(obj); } function mk(tagname, attrs, ...children) { const el = document.createElement(tagname); for(const [k,v] of iter(attrs)) { if(k.slice(0,3) == "_on") { const eventName = k.slice(3); el.addEventListener(eventName, v); } else if(k[0] == "_") { // property, not attribute el[k.slice(1)] = v; } else { if(v === false || v == null) { continue; } else if(v === true) { el.setAttribute(k, ""); continue; } else { el.setAttribute(k, v); } } } append(el, children); return el; } /* Create shortcuts for every known HTML element */ [ "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "link", "main", "map", "mark", "meta", "meter", "nav", "nobr", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "pre", "progress", "q", "s", "samp", "script", "section", "select", "small", "source", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "u", "ul", "var", "video", "wbr", "xmp", ].forEach(tagname=>{ mk[tagname] = (...args) => mk(tagname, ...args); }); function* nodesFromChildList(children) { for(const child of children.flat(Infinity)) { if(child instanceof Node) { yield child; } else { yield new Text(child); } } } function append(el, ...children) { for(const child of nodesFromChildList(children)) { if(el instanceof Node) el.appendChild(child); else el.push(child); } return el; } function insertAfter(el, ...children) { for(const child of nodesFromChildList(children)) { el.parentNode.insertBefore(child, el.nextSibling); } return el; } function clearContents(el) { el.innerHTML = ""; return el; } function parseHTML(markup) { if(markup.toLowerCase().trim().indexOf('<!doctype') === 0) { const doc = document.implementation.createHTMLDocument(""); doc.documentElement.innerHTML = markup; return doc; } else { const el = mk.template({}); el.innerHTML = markup; return el.content; } }</script> <script>/* Boilerplate: script-dfn-panel */ "use strict"; { let dfnPanelData = { "0027e642": {"dfnID":"0027e642","dfnText":"media data","external":true,"refSections":[{"refs":[{"id":"ref-for-media-data"},{"id":"ref-for-media-data\u2460"}],"title":"11.2. \nMedia Loading State: the :buffering and :stalled pseudo-classes"}],"url":"https://html.spec.whatwg.org/multipage/media.html#media-data"}, "0190963b": {"dfnID":"0190963b","dfnText":"<hash-token>","external":true,"refSections":[{"refs":[{"id":"ref-for-typedef-hash-token"},{"id":"ref-for-typedef-hash-token\u2460"}],"title":"18. \nGrammar"}],"url":"https://drafts.csswg.org/css-syntax-3/#typedef-hash-token"}, "07308da5": {"dfnID":"07308da5","dfnText":"<ident-token>","external":true,"refSections":[{"refs":[{"id":"ref-for-typedef-ident-token"}],"title":"6.1. \nAttribute presence and value selectors"},{"refs":[{"id":"ref-for-typedef-ident-token\u2460"}],"title":"6.2. \nSubstring matching attribute selectors"},{"refs":[{"id":"ref-for-typedef-ident-token\u2461"},{"id":"ref-for-typedef-ident-token\u2462"},{"id":"ref-for-typedef-ident-token\u2463"},{"id":"ref-for-typedef-ident-token\u2464"},{"id":"ref-for-typedef-ident-token\u2465"},{"id":"ref-for-typedef-ident-token\u2466"}],"title":"18. \nGrammar"}],"url":"https://drafts.csswg.org/css-syntax-3/#typedef-ident-token"}, "08eba280": {"dfnID":"08eba280","dfnText":"!","external":true,"refSections":[{"refs":[{"id":"ref-for-mult-req"},{"id":"ref-for-mult-req\u2460"}],"title":"18. \nGrammar"}],"url":"https://drafts.csswg.org/css-values-4/#mult-req"}, "09cd65e4": {"dfnID":"09cd65e4","dfnText":"display type","external":true,"refSections":[{"refs":[{"id":"ref-for-display-type"}],"title":"3.6.4. \nSub-pseudo-elements"}],"url":"https://drafts.csswg.org/css-display-4/#display-type"}, "0e9419b9": {"dfnID":"0e9419b9","dfnText":"display","external":true,"refSections":[{"refs":[{"id":"ref-for-propdef-display"}],"title":"12.1. \nCollapse State: the :open and :closed pseudo-class"},{"refs":[{"id":"ref-for-propdef-display\u2460"}],"title":"13.1.1. \nThe :enabled and :disabled Pseudo-classes"}],"url":"https://drafts.csswg.org/css-display-3/#propdef-display"}, "12f8fb07": {"dfnID":"12f8fb07","dfnText":"visibility","external":true,"refSections":[{"refs":[{"id":"ref-for-propdef-visibility"}],"title":"12.1. \nCollapse State: the :open and :closed pseudo-class"},{"refs":[{"id":"ref-for-propdef-visibility\u2460"}],"title":"13.1.1. \nThe :enabled and :disabled Pseudo-classes"}],"url":"https://drafts.csswg.org/css-display-4/#propdef-visibility"}, "16a52cab": {"dfnID":"16a52cab","dfnText":"tree-abiding pseudo-elements","external":true,"refSections":[{"refs":[{"id":"ref-for-tree-abiding\u2460"}],"title":"18. \nGrammar"},{"refs":[{"id":"ref-for-tree-abiding\u2461"}],"title":"19.5. \nMatch a Selector Against a Tree"}],"url":"https://drafts.csswg.org/css-pseudo-4/#tree-abiding"}, "1748bbeb": {"dfnID":"1748bbeb","dfnText":"details","external":true,"refSections":[{"refs":[{"id":"ref-for-the-details-element"}],"title":"12.1. \nCollapse State: the :open and :closed pseudo-class"}],"url":"https://html.spec.whatwg.org/multipage/interactive-elements.html#the-details-element"}, "1812300f": {"dfnID":"1812300f","dfnText":"dialog","external":true,"refSections":[{"refs":[{"id":"ref-for-the-dialog-element"},{"id":"ref-for-the-dialog-element\u2460"}],"title":"12.1. \nCollapse State: the :open and :closed pseudo-class"},{"refs":[{"id":"ref-for-the-dialog-element\u2461"}],"title":"12.2. \nModal (Exclusive Interaction) State: the :modal pseudo-class"}],"url":"https://html.spec.whatwg.org/multipage/interactive-elements.html#the-dialog-element"}, "19f9e9df": {"dfnID":"19f9e9df","dfnText":"shadow tree","external":true,"refSections":[{"refs":[{"id":"ref-for-concept-shadow-tree"}],"title":"3.2.1. \nFeatureless Elements"}],"url":"https://dom.spec.whatwg.org/#concept-shadow-tree"}, "22109b0e": {"dfnID":"22109b0e","dfnText":"flat tree","external":true,"refSections":[{"refs":[{"id":"ref-for-flat-tree"}],"title":"8.5. \nThe Target Container Pseudo-class: :target-within"},{"refs":[{"id":"ref-for-flat-tree\u2460"}],"title":"9.1. \nThe Pointer Hover Pseudo-class: :hover"},{"refs":[{"id":"ref-for-flat-tree\u2461"}],"title":"9.2. \nThe Activation Pseudo-class: :active"},{"refs":[{"id":"ref-for-flat-tree\u2462"}],"title":"9.5. \nThe Focus Container Pseudo-class: :focus-within"}],"url":"https://drafts.csswg.org/css-scoping-1/#flat-tree"}, "22a0e026": {"dfnID":"22a0e026","dfnText":"pre","external":true,"refSections":[{"refs":[{"id":"ref-for-the-pre-element"}],"title":"15.4. \nSubsequent-sibling combinator (~)"}],"url":"https://html.spec.whatwg.org/multipage/grouping-content.html#the-pre-element"}, "28c097f8": {"dfnID":"28c097f8","dfnText":"effective media volume","external":true,"refSections":[{"refs":[{"id":"ref-for-effective-media-volume"}],"title":"11.3. \nSound State: the :muted and :volume-locked pseudo-classes"}],"url":"https://html.spec.whatwg.org/multipage/media.html#effective-media-volume"}, "2c82d279": {"dfnID":"2c82d279","dfnText":"audio","external":true,"refSections":[{"refs":[{"id":"ref-for-audio"}],"title":"11.1. \nMedia Playback State: the :playing, :paused, and :seeking pseudo-classes"},{"refs":[{"id":"ref-for-audio\u2460"}],"title":"11.2. \nMedia Loading State: the :buffering and :stalled pseudo-classes"},{"refs":[{"id":"ref-for-audio\u2461"},{"id":"ref-for-audio\u2462"}],"title":"11.3. \nSound State: the :muted and :volume-locked pseudo-classes"}],"url":"https://html.spec.whatwg.org/multipage/media.html#audio"}, "2f0ba72c": {"dfnID":"2f0ba72c","dfnText":"document element","external":true,"refSections":[{"refs":[{"id":"ref-for-document-element"}],"title":"14.1. \n:root pseudo-class"}],"url":"https://dom.spec.whatwg.org/#document-element"}, "3a098985": {"dfnID":"3a098985","dfnText":"<an+b>","external":true,"refSections":[{"refs":[{"id":"ref-for-anb-production"}],"title":"20.4. \nChanges since the 2 May 2013 Working Draft"},{"refs":[{"id":"ref-for-anb-production\u2460"}],"title":"20.5. \nChanges since the 23 August 2012 Working Draft"}],"url":"https://drafts.csswg.org/css-syntax-3/#anb-production"}, "49a2843d": {"dfnID":"49a2843d","dfnText":"DocumentFragment","external":true,"refSections":[{"refs":[{"id":"ref-for-documentfragment"},{"id":"ref-for-documentfragment\u2460"}],"title":"8.6. \nThe Reference Element Pseudo-class: :scope"}],"url":"https://dom.spec.whatwg.org/#documentfragment"}, "537cf076": {"dfnID":"537cf076","dfnText":"?","external":true,"refSections":[{"refs":[{"id":"ref-for-mult-opt"},{"id":"ref-for-mult-opt\u2460"},{"id":"ref-for-mult-opt\u2461"},{"id":"ref-for-mult-opt\u2462"},{"id":"ref-for-mult-opt\u2463"},{"id":"ref-for-mult-opt\u2464"},{"id":"ref-for-mult-opt\u2465"},{"id":"ref-for-mult-opt\u2466"},{"id":"ref-for-mult-opt\u2467"},{"id":"ref-for-mult-opt\u2468"},{"id":"ref-for-mult-opt\u2460\u24ea"}],"title":"18. \nGrammar"}],"url":"https://drafts.csswg.org/css-values-4/#mult-opt"}, "53a193f1": {"dfnID":"53a193f1","dfnText":"*","external":true,"refSections":[{"refs":[{"id":"ref-for-x"}],"title":"3.2.1. \nFeatureless Elements"},{"refs":[{"id":"ref-for-x\u2460"}],"title":"3.6.2. \nBinding to the Document Tree"}],"url":"https://drafts.csswg.org/selectors-3/#x"}, "5869f885": {"dfnID":"5869f885","dfnText":"::before","external":true,"refSections":[{"refs":[{"id":"ref-for-selectordef-before"},{"id":"ref-for-selectordef-before\u2460"}],"title":"3.1. \nStructure and Terminology"},{"refs":[{"id":"ref-for-selectordef-before\u2461"}],"title":"3.6. Pseudo-elements"},{"refs":[{"id":"ref-for-selectordef-before\u2462"}],"title":"3.6.1. \nSyntax"},{"refs":[{"id":"ref-for-selectordef-before\u2463"}],"title":"3.6.2. \nBinding to the Document Tree"},{"refs":[{"id":"ref-for-selectordef-before\u2464"}],"title":"3.6.4. \nSub-pseudo-elements"},{"refs":[{"id":"ref-for-selectordef-before\u2466"}],"title":"18. \nGrammar"}],"url":"https://drafts.csswg.org/css-pseudo-4/#selectordef-before"}, "5875aeb9": {"dfnID":"5875aeb9","dfnText":"::marker","external":true,"refSections":[{"refs":[{"id":"ref-for-selectordef-marker"}],"title":"3.1. \nStructure and Terminology"}],"url":"https://drafts.csswg.org/css-pseudo-4/#selectordef-marker"}, "5879b11d": {"dfnID":"5879b11d","dfnText":"content language","external":true,"refSections":[{"refs":[{"id":"ref-for-content-language"},{"id":"ref-for-content-language\u2460"},{"id":"ref-for-content-language\u2461"},{"id":"ref-for-content-language\u2462"},{"id":"ref-for-content-language\u2463"},{"id":"ref-for-content-language\u2464"},{"id":"ref-for-content-language\u2465"},{"id":"ref-for-content-language\u2466"}],"title":"7.2. \nThe Language Pseudo-class: :lang()"}],"url":"https://drafts.csswg.org/css-text-4/#content-language"}, "58a8f724": {"dfnID":"58a8f724","dfnText":"shadow host","external":true,"refSections":[{"refs":[{"id":"ref-for-element-shadow-host"},{"id":"ref-for-element-shadow-host\u2460"},{"id":"ref-for-element-shadow-host\u2461"},{"id":"ref-for-element-shadow-host\u2462"},{"id":"ref-for-element-shadow-host\u2463"},{"id":"ref-for-element-shadow-host\u2464"}],"title":"3.2.1. \nFeatureless Elements"}],"url":"https://dom.spec.whatwg.org/#element-shadow-host"}, "5bc8bd12": {"dfnID":"5bc8bd12","dfnText":"direction","external":true,"refSections":[{"refs":[{"id":"ref-for-propdef-direction"}],"title":"7.1. \nThe Directionality Pseudo-class: :dir()"}],"url":"https://drafts.csswg.org/css-writing-modes-3/#propdef-direction"}, "5f4f7d1c": {"dfnID":"5f4f7d1c","dfnText":"math","external":true,"refSections":[{"refs":[{"id":"ref-for-dfn-math"}],"title":"15.3. \nNext-sibling combinator (+)"}],"url":"https://w3c.github.io/mathml-core/#dfn-math"}, "6158d44a": {"dfnID":"6158d44a","dfnText":"<string-token>","external":true,"refSections":[{"refs":[{"id":"ref-for-typedef-string-token"}],"title":"6.1. \nAttribute presence and value selectors"},{"refs":[{"id":"ref-for-typedef-string-token\u2460"}],"title":"6.2. \nSubstring matching attribute selectors"},{"refs":[{"id":"ref-for-typedef-string-token\u2461"}],"title":"18. \nGrammar"}],"url":"https://drafts.csswg.org/css-syntax-3/#typedef-string-token"}, "64b89595": {"dfnID":"64b89595","dfnText":"meta","external":true,"refSections":[{"refs":[{"id":"ref-for-meta"}],"title":"7.2. \nThe Language Pseudo-class: :lang()"}],"url":"https://html.spec.whatwg.org/multipage/semantics.html#meta"}, "655fdd86": {"dfnID":"655fdd86","dfnText":"muted","external":true,"refSections":[{"refs":[{"id":"ref-for-concept-media-muted"}],"title":"11.3. \nSound State: the :muted and :volume-locked pseudo-classes"}],"url":"https://html.spec.whatwg.org/multipage/media.html#concept-media-muted"}, "68150e76": {"dfnID":"68150e76","dfnText":"*","external":true,"refSections":[{"refs":[{"id":"ref-for-mult-zero-plus"},{"id":"ref-for-mult-zero-plus\u2460"},{"id":"ref-for-mult-zero-plus\u2461"},{"id":"ref-for-mult-zero-plus\u2462"},{"id":"ref-for-mult-zero-plus\u2463"}],"title":"18. \nGrammar"}],"url":"https://drafts.csswg.org/css-values-4/#mult-zero-plus"}, "68487d22": {"dfnID":"68487d22","dfnText":"#","external":true,"refSections":[{"refs":[{"id":"ref-for-mult-comma"},{"id":"ref-for-mult-comma\u2460"},{"id":"ref-for-mult-comma\u2461"},{"id":"ref-for-mult-comma\u2462"},{"id":"ref-for-mult-comma\u2463"},{"id":"ref-for-mult-comma\u2464"}],"title":"18. \nGrammar"}],"url":"https://drafts.csswg.org/css-values-4/#mult-comma"}, "68bf3d31": {"dfnID":"68bf3d31","dfnText":"a","external":true,"refSections":[{"refs":[{"id":"ref-for-the-a-element"},{"id":"ref-for-the-a-element\u2460"}],"title":"3.3. \nScoped Selectors"},{"refs":[{"id":"ref-for-the-a-element\u2461"},{"id":"ref-for-the-a-element\u2462"},{"id":"ref-for-the-a-element\u2463"},{"id":"ref-for-the-a-element\u2464"},{"id":"ref-for-the-a-element\u2465"}],"title":"6.1. \nAttribute presence and value selectors"},{"refs":[{"id":"ref-for-the-a-element\u2466"}],"title":"6.2. \nSubstring matching attribute selectors"},{"refs":[{"id":"ref-for-the-a-element\u2467"}],"title":"8.1. \nThe Hyperlink Pseudo-class: :any-link"}],"url":"https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element"}, "6ec67710": {"dfnID":"6ec67710","dfnText":"|","external":true,"refSections":[{"refs":[{"id":"ref-for-comb-one"},{"id":"ref-for-comb-one\u2460"},{"id":"ref-for-comb-one\u2461"},{"id":"ref-for-comb-one\u2462"},{"id":"ref-for-comb-one\u2463"},{"id":"ref-for-comb-one\u2464"},{"id":"ref-for-comb-one\u2465"},{"id":"ref-for-comb-one\u2466"},{"id":"ref-for-comb-one\u2467"},{"id":"ref-for-comb-one\u2468"},{"id":"ref-for-comb-one\u2460\u24ea"},{"id":"ref-for-comb-one\u2460\u2460"},{"id":"ref-for-comb-one\u2460\u2461"},{"id":"ref-for-comb-one\u2460\u2462"},{"id":"ref-for-comb-one\u2460\u2463"},{"id":"ref-for-comb-one\u2460\u2464"},{"id":"ref-for-comb-one\u2460\u2465"},{"id":"ref-for-comb-one\u2460\u2466"},{"id":"ref-for-comb-one\u2460\u2467"},{"id":"ref-for-comb-one\u2460\u2468"},{"id":"ref-for-comb-one\u2461\u24ea"}],"title":"18. \nGrammar"}],"url":"https://drafts.csswg.org/css-values-4/#comb-one"}, "6f0f52dc": {"dfnID":"6f0f52dc","dfnText":"parentNode","external":true,"refSections":[{"refs":[{"id":"ref-for-dom-node-parentnode"}],"title":"8.6. \nThe Reference Element Pseudo-class: :scope"}],"url":"https://dom.spec.whatwg.org/#dom-node-parentnode"}, "6f539384": {"dfnID":"6f539384","dfnText":":host-context()","external":true,"refSections":[{"refs":[{"id":"ref-for-selectordef-host-context"}],"title":"3.2.1. \nFeatureless Elements"}],"url":"https://drafts.csswg.org/css-scoping-1/#selectordef-host-context"}, "7486f2c8": {"dfnID":"7486f2c8","dfnText":"li","external":true,"refSections":[{"refs":[{"id":"ref-for-the-li-element"},{"id":"ref-for-the-li-element\u2460"}],"title":"15.2. \nChild combinator (>)"}],"url":"https://html.spec.whatwg.org/multipage/grouping-content.html#the-li-element"}, "74a27486": {"dfnID":"74a27486","dfnText":":before","external":true,"refSections":[{"refs":[{"id":"ref-for-selectordef-before\u2465"}],"title":"18. \nGrammar"}],"url":"https://drafts.csswg.org/css2/#selectordef-before"}, "75bfa627": {"dfnID":"75bfa627","dfnText":"::first-line","external":true,"refSections":[{"refs":[{"id":"ref-for-selectordef-first-line"},{"id":"ref-for-selectordef-first-line\u2460"}],"title":"3.2. \nData Model"},{"refs":[{"id":"ref-for-selectordef-first-line\u2461"},{"id":"ref-for-selectordef-first-line\u2462"}],"title":"3.6. Pseudo-elements"},{"refs":[{"id":"ref-for-selectordef-first-line\u2463"}],"title":"3.6.1. \nSyntax"},{"refs":[{"id":"ref-for-selectordef-first-line\u2464"},{"id":"ref-for-selectordef-first-line\u2465"}],"title":"3.6.2. \nBinding to the Document Tree"},{"refs":[{"id":"ref-for-selectordef-first-line\u2466"},{"id":"ref-for-selectordef-first-line\u2467"}],"title":"3.6.3. \nPseudo-classing Pseudo-elements"},{"refs":[{"id":"ref-for-selectordef-first-line\u2468"}],"title":"18. \nGrammar"}],"url":"https://drafts.csswg.org/css-pseudo-4/#selectordef-first-line"}, "76c4403d": {"dfnID":"76c4403d","dfnText":"parse","external":true,"refSections":[{"refs":[{"id":"ref-for-css-parse-something-according-to-a-css-grammar"}],"title":"18. \nGrammar"},{"refs":[{"id":"ref-for-css-parse-something-according-to-a-css-grammar\u2460"}],"title":"19.1. \nParse A Selector"},{"refs":[{"id":"ref-for-css-parse-something-according-to-a-css-grammar\u2461"}],"title":"19.2. \nParse A Relative Selector"}],"url":"https://drafts.csswg.org/css-syntax-3/#css-parse-something-according-to-a-css-grammar"}, "7992f81d": {"dfnID":"7992f81d","dfnText":"em","external":true,"refSections":[{"refs":[{"id":"ref-for-the-em-element"},{"id":"ref-for-the-em-element\u2460"}],"title":"15.1. \nDescendant combinator ( )"}],"url":"https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-em-element"}, "7a348049": {"dfnID":"7a348049","dfnText":"h1","external":true,"refSections":[{"refs":[{"id":"ref-for-the-h1-element"}],"title":"5.1. \nType (tag name) selector"},{"refs":[{"id":"ref-for-the-h1-element\u2460"},{"id":"ref-for-the-h1-element\u2461"},{"id":"ref-for-the-h1-element\u2462"}],"title":"5.3. \nNamespaces in Elemental Selectors"},{"refs":[{"id":"ref-for-the-h1-element\u2463"}],"title":"6.1. \nAttribute presence and value selectors"},{"refs":[{"id":"ref-for-the-h1-element\u2464"}],"title":"6.7. \nID selectors"},{"refs":[{"id":"ref-for-the-h1-element\u2465"},{"id":"ref-for-the-h1-element\u2466"}],"title":"15.1. \nDescendant combinator ( )"},{"refs":[{"id":"ref-for-the-h1-element\u2467"}],"title":"15.3. \nNext-sibling combinator (+)"}],"url":"https://html.spec.whatwg.org/multipage/sections.html#the-h1-element"}, "7f9469b5": {"dfnID":"7f9469b5","dfnText":"ASCII case-insensitive","external":true,"refSections":[{"refs":[{"id":"ref-for-ascii-case-insensitive"}],"title":"3.5. \nPseudo-classes"},{"refs":[{"id":"ref-for-ascii-case-insensitive\u2460"}],"title":"3.6.1. \nSyntax"},{"refs":[{"id":"ref-for-ascii-case-insensitive\u2461"}],"title":"3.7. \nCharacters and case sensitivity"},{"refs":[{"id":"ref-for-ascii-case-insensitive\u2462"},{"id":"ref-for-ascii-case-insensitive\u2463"},{"id":"ref-for-ascii-case-insensitive\u2464"}],"title":"6.3. \nCase-sensitivity"},{"refs":[{"id":"ref-for-ascii-case-insensitive\u2465"}],"title":"6.6. \nClass selectors"},{"refs":[{"id":"ref-for-ascii-case-insensitive\u2466"}],"title":"6.7. \nID selectors"},{"refs":[{"id":"ref-for-ascii-case-insensitive\u2467"}],"title":"\nAppendix B: Obsolete but Required -webkit- Parsing Quirks for Web Compat"}],"url":"https://infra.spec.whatwg.org/#ascii-case-insensitive"}, "84f243ef": {"dfnID":"84f243ef","dfnText":"label","external":true,"refSections":[{"refs":[{"id":"ref-for-the-label-element"}],"title":"9.1. \nThe Pointer Hover Pseudo-class: :hover"},{"refs":[{"id":"ref-for-the-label-element\u2460"}],"title":"9.3. \nThe Input Focus Pseudo-class: :focus"}],"url":"https://html.spec.whatwg.org/multipage/forms.html#the-label-element"}, "85188fb3": {"dfnID":"85188fb3","dfnText":"select","external":true,"refSections":[{"refs":[{"id":"ref-for-the-select-element"}],"title":"12.1. \nCollapse State: the :open and :closed pseudo-class"}],"url":"https://html.spec.whatwg.org/multipage/form-elements.html#the-select-element"}, "8716d04f": {"dfnID":"8716d04f","dfnText":"<any-value>","external":true,"refSections":[{"refs":[{"id":"ref-for-typedef-any-value"}],"title":"18. \nGrammar"},{"refs":[{"id":"ref-for-typedef-any-value\u2460"}],"title":"18.1. \n<forgiving-selector-list> and <forgiving-relative-selector-list>"}],"url":"https://drafts.csswg.org/css-syntax-3/#typedef-any-value"}, "877c1491": {"dfnID":"877c1491","dfnText":"<forgiving-relative-selector-list>","external":true,"refSections":[{"refs":[{"id":"ref-for-typedef-forgiving-relative-selector-list"}],"title":"18.1. \n<forgiving-selector-list> and <forgiving-relative-selector-list>"}],"url":"https://www.w3.org/TR/selectors-4/#typedef-forgiving-relative-selector-list"}, "8bc6d766": {"dfnID":"8bc6d766","dfnText":"inclusive sibling","external":true,"refSections":[{"refs":[{"id":"ref-for-concept-tree-inclusive-sibling"}],"title":"14.3. \nChild-indexed Pseudo-classes"},{"refs":[{"id":"ref-for-concept-tree-inclusive-sibling\u2460"}],"title":"14.3.1. \n:nth-child() pseudo-class"},{"refs":[{"id":"ref-for-concept-tree-inclusive-sibling\u2461"}],"title":"14.3.2. \n:nth-last-child() pseudo-class"},{"refs":[{"id":"ref-for-concept-tree-inclusive-sibling\u2462"}],"title":"14.3.3. \n:first-child pseudo-class"},{"refs":[{"id":"ref-for-concept-tree-inclusive-sibling\u2463"}],"title":"14.3.4. \n:last-child pseudo-class"}],"url":"https://dom.spec.whatwg.org/#concept-tree-inclusive-sibling"}, "91c016b5": {"dfnID":"91c016b5","dfnText":"identical to","external":true,"refSections":[{"refs":[{"id":"ref-for-string-is"}],"title":"2. \nSelectors Overview"},{"refs":[{"id":"ref-for-string-is\u2460"}],"title":"6.3. \nCase-sensitivity"},{"refs":[{"id":"ref-for-string-is\u2461"}],"title":"6.6. \nClass selectors"},{"refs":[{"id":"ref-for-string-is\u2462"}],"title":"6.7. \nID selectors"}],"url":"https://infra.spec.whatwg.org/#string-is"}, "9213678e": {"dfnID":"9213678e","dfnText":"<ident>","external":true,"refSections":[{"refs":[{"id":"ref-for-typedef-ident"}],"title":"7.2. \nThe Language Pseudo-class: :lang()"}],"url":"https://drafts.csswg.org/css-values-4/#typedef-ident"}, "96626f55": {"dfnID":"96626f55","dfnText":"list-item","external":true,"refSections":[{"refs":[{"id":"ref-for-valdef-display-list-item"}],"title":"3.6.4. \nSub-pseudo-elements"}],"url":"https://drafts.csswg.org/css-display-4/#valdef-display-list-item"}, "977d3003": {"dfnID":"977d3003","dfnText":"<string>","external":true,"refSections":[{"refs":[{"id":"ref-for-string-value"}],"title":"7.2. \nThe Language Pseudo-class: :lang()"}],"url":"https://drafts.csswg.org/css-values-4/#string-value"}, "99b5cef6": {"dfnID":"99b5cef6","dfnText":"object","external":true,"refSections":[{"refs":[{"id":"ref-for-the-object-element"}],"title":"6.2. \nSubstring matching attribute selectors"}],"url":"https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-object-element"}, "9d861566": {"dfnID":"9d861566","dfnText":"showModal()","external":true,"refSections":[{"refs":[{"id":"ref-for-dom-dialog-showmodal"}],"title":"12.2. \nModal (Exclusive Interaction) State: the :modal pseudo-class"}],"url":"https://html.spec.whatwg.org/multipage/interactive-elements.html#dom-dialog-showmodal"}, "9dc3e09f": {"dfnID":"9dc3e09f","dfnText":"q","external":true,"refSections":[{"refs":[{"id":"ref-for-the-q-element"}],"title":"7.2. \nThe Language Pseudo-class: :lang()"}],"url":"https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-q-element"}, "9dc6ce48": {"dfnID":"9dc6ce48","dfnText":"identifier","external":true,"refSections":[{"refs":[{"id":"ref-for-css-css-identifier"}],"title":"3.5. \nPseudo-classes"},{"refs":[{"id":"ref-for-css-css-identifier\u2460"}],"title":"3.6.1. \nSyntax"},{"refs":[{"id":"ref-for-css-css-identifier\u2461"}],"title":"5.1. \nType (tag name) selector"},{"refs":[{"id":"ref-for-css-css-identifier\u2462"}],"title":"18. \nGrammar"}],"url":"https://drafts.csswg.org/css-values-4/#css-css-identifier"}, "9ffb0043": {"dfnID":"9ffb0043","dfnText":"a","external":true,"refSections":[{"refs":[{"id":"ref-for-valdef-lab-a"}],"title":"3.6.2. \nBinding to the Document Tree"}],"url":"https://drafts.csswg.org/css-color-5/#valdef-lab-a"}, "a1a807e5": {"dfnID":"a1a807e5","dfnText":"area","external":true,"refSections":[{"refs":[{"id":"ref-for-the-area-element"}],"title":"8.1. \nThe Hyperlink Pseudo-class: :any-link"}],"url":"https://html.spec.whatwg.org/multipage/image-maps.html#the-area-element"}, "a1addf6c": {"dfnID":"a1addf6c","dfnText":"::first-letter","external":true,"refSections":[{"refs":[{"id":"ref-for-selectordef-first-letter"}],"title":"3.6. Pseudo-elements"},{"refs":[{"id":"ref-for-selectordef-first-letter\u2460"}],"title":"3.6.1. \nSyntax"},{"refs":[{"id":"ref-for-selectordef-first-letter\u2461"}],"title":"18. \nGrammar"}],"url":"https://drafts.csswg.org/css-pseudo-4/#selectordef-first-letter"}, "a658d30c": {"dfnID":"a658d30c","dfnText":"::shadow","external":true,"refSections":[{"refs":[{"id":"ref-for-selectordef-shadow"}],"title":"3.6.5. \nInternal Structure"}],"url":"https://www.w3.org/TR/css-scoping-1/#selectordef-shadow"}, "a7bbaf9f": {"dfnID":"a7bbaf9f","dfnText":"div","external":true,"refSections":[{"refs":[{"id":"ref-for-the-div-element"}],"title":"6.6. \nClass selectors"},{"refs":[{"id":"ref-for-the-div-element\u2460"}],"title":"14.3.3. \n:first-child pseudo-class"},{"refs":[{"id":"ref-for-the-div-element\u2461"}],"title":"15.1. \nDescendant combinator ( )"}],"url":"https://html.spec.whatwg.org/multipage/grouping-content.html#the-div-element"}, "a963f9ba": {"dfnID":"a963f9ba","dfnText":"document white space characters","external":true,"refSections":[{"refs":[{"id":"ref-for-white-space"}],"title":"14.2. \n:empty pseudo-class"}],"url":"https://drafts.csswg.org/css-text-4/#white-space"}, "aa7bbf63": {"dfnID":"aa7bbf63","dfnText":"video","external":true,"refSections":[{"refs":[{"id":"ref-for-video"}],"title":"11.1. \nMedia Playback State: the :playing, :paused, and :seeking pseudo-classes"},{"refs":[{"id":"ref-for-video\u2460"}],"title":"11.2. \nMedia Loading State: the :buffering and :stalled pseudo-classes"},{"refs":[{"id":"ref-for-video\u2461"},{"id":"ref-for-video\u2462"}],"title":"11.3. \nSound State: the :muted and :volume-locked pseudo-classes"}],"url":"https://html.spec.whatwg.org/multipage/media.html#video"}, "active-pseudo": {"dfnID":"active-pseudo","dfnText":":active","external":false,"refSections":[{"refs":[{"id":"ref-for-active-pseudo"},{"id":"ref-for-active-pseudo\u2460"},{"id":"ref-for-active-pseudo\u2461"}],"title":"9.2. \nThe Activation Pseudo-class: :active"}],"url":"#active-pseudo"}, "af50aa62": {"dfnID":"af50aa62","dfnText":"<function-token>","external":true,"refSections":[{"refs":[{"id":"ref-for-typedef-function-token"},{"id":"ref-for-typedef-function-token\u2460"}],"title":"18. \nGrammar"}],"url":"https://drafts.csswg.org/css-syntax-3/#typedef-function-token"}, "any-link-pseudo": {"dfnID":"any-link-pseudo","dfnText":":any-link","external":false,"refSections":[{"refs":[{"id":"ref-for-any-link-pseudo"}],"title":"8.1. \nThe Hyperlink Pseudo-class: :any-link"},{"refs":[{"id":"ref-for-any-link-pseudo\u2460"}],"title":"20.7. \nChanges Since Level 3"}],"url":"#any-link-pseudo"}, "attribute-selector": {"dfnID":"attribute-selector","dfnText":"attribute selector","external":false,"refSections":[{"refs":[{"id":"ref-for-attribute-selector"}],"title":"3.1. \nStructure and Terminology"}],"url":"#attribute-selector"}, "b2198f14": {"dfnID":"b2198f14","dfnText":"media element stall timeout","external":true,"refSections":[{"refs":[{"id":"ref-for-stall-timeout"}],"title":"11.2. \nMedia Loading State: the :buffering and :stalled pseudo-classes"}],"url":"https://html.spec.whatwg.org/multipage/media.html#stall-timeout"}, "b32b852a": {"dfnID":"b32b852a","dfnText":"span","external":true,"refSections":[{"refs":[{"id":"ref-for-the-span-element"},{"id":"ref-for-the-span-element\u2460"}],"title":"6.1. \nAttribute presence and value selectors"},{"refs":[{"id":"ref-for-the-span-element\u2461"}],"title":"6.6. \nClass selectors"}],"url":"https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-span-element"}, "b54af98a": {"dfnID":"b54af98a","dfnText":"tree-abiding","external":true,"refSections":[{"refs":[{"id":"ref-for-tree-abiding"}],"title":"Unnumbered Section"}],"url":"https://www.w3.org/TR/css-pseudo-4/#tree-abiding"}, "b6fb7a51": {"dfnID":"b6fb7a51","dfnText":"custom element","external":true,"refSections":[{"refs":[{"id":"ref-for-custom-element"}],"title":"5.4. \nThe Defined Pseudo-class: :defined"}],"url":"https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element"}, "b80d76a2": {"dfnID":"b80d76a2","dfnText":"p","external":true,"refSections":[{"refs":[{"id":"ref-for-the-p-element"}],"title":"6.6. \nClass selectors"},{"refs":[{"id":"ref-for-the-p-element\u2460"}],"title":"8.4. \nThe Target Pseudo-class: :target"},{"refs":[{"id":"ref-for-the-p-element\u2461"}],"title":"13.3.2. \nThe Validity Pseudo-classes: :valid and :invalid"},{"refs":[{"id":"ref-for-the-p-element\u2462"}],"title":"14.2. \n:empty pseudo-class"},{"refs":[{"id":"ref-for-the-p-element\u2463"}],"title":"14.3.3. \n:first-child pseudo-class"},{"refs":[{"id":"ref-for-the-p-element\u2464"}],"title":"15.1. \nDescendant combinator ( )"},{"refs":[{"id":"ref-for-the-p-element\u2465"},{"id":"ref-for-the-p-element\u2466"}],"title":"15.2. \nChild combinator (>)"},{"refs":[{"id":"ref-for-the-p-element\u2467"}],"title":"15.3. \nNext-sibling combinator (+)"}],"url":"https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element"}, "b8e482b4": {"dfnID":"b8e482b4","dfnText":":host","external":true,"refSections":[{"refs":[{"id":"ref-for-selectordef-host"}],"title":"3.2.1. \nFeatureless Elements"}],"url":"https://drafts.csswg.org/css-scoping-1/#selectordef-host"}, "b9a05383": {"dfnID":"b9a05383","dfnText":"placeholder","external":true,"refSections":[{"refs":[{"id":"ref-for-attr-input-placeholder"}],"title":"13.1.3. \nThe Placeholder-shown Pseudo-class: :placeholder-shown"}],"url":"https://html.spec.whatwg.org/multipage/input.html#attr-input-placeholder"}, "bcdb6841": {"dfnID":"bcdb6841","dfnText":"requestFullscreen()","external":true,"refSections":[{"refs":[{"id":"ref-for-dom-element-requestfullscreen"}],"title":"12.2. \nModal (Exclusive Interaction) State: the :modal pseudo-class"}],"url":"https://fullscreen.spec.whatwg.org/#dom-element-requestfullscreen"}, "bf0e8186": {"dfnID":"bf0e8186","dfnText":"@namespace","external":true,"refSections":[{"refs":[{"id":"ref-for-at-ruledef-namespace"}],"title":"3.8. \nDeclaring Namespace Prefixes"},{"refs":[{"id":"ref-for-at-ruledef-namespace\u2460"}],"title":"5.3. \nNamespaces in Elemental Selectors"}],"url":"https://drafts.csswg.org/css-namespaces-3/#at-ruledef-namespace"}, "bfff6250": {"dfnID":"bfff6250","dfnText":"button","external":true,"refSections":[{"refs":[{"id":"ref-for-the-button-element"}],"title":"4.3. \nThe Negation (Matches-None) Pseudo-class: :not()"}],"url":"https://html.spec.whatwg.org/multipage/form-elements.html#the-button-element"}, "blank-pseudo": {"dfnID":"blank-pseudo","dfnText":":blank","external":false,"refSections":[{"refs":[{"id":"ref-for-blank-pseudo\u2460"},{"id":"ref-for-blank-pseudo\u2461"},{"id":"ref-for-blank-pseudo\u2462"},{"id":"ref-for-blank-pseudo\u2463"},{"id":"ref-for-blank-pseudo\u2464"},{"id":"ref-for-blank-pseudo\u2465"},{"id":"ref-for-blank-pseudo\u2466"}],"title":"13.3.1. \nThe Empty-Value Pseudo-class: :blank"},{"refs":[{"id":"ref-for-blank-pseudo\u2467"}],"title":"20.1. \nChanges since the 7 May 2022 Working Draft"},{"refs":[{"id":"ref-for-blank-pseudo\u2468"}],"title":"20.3. \nChanges since the 2 February 2018 Working Draft"},{"refs":[{"id":"ref-for-blank-pseudo\u2460\u24ea"}],"title":"20.7. \nChanges Since Level 3"}],"url":"#blank-pseudo"}, "c3dd181e": {"dfnID":"c3dd181e","dfnText":"html","external":true,"refSections":[{"refs":[{"id":"ref-for-the-html-element"}],"title":"14.1. \n:root pseudo-class"}],"url":"https://html.spec.whatwg.org/multipage/semantics.html#the-html-element"}, "c90d9be6": {"dfnID":"c90d9be6","dfnText":"::slotted()","external":true,"refSections":[{"refs":[{"id":"ref-for-selectordef-slotted"}],"title":"18. \nGrammar"}],"url":"https://drafts.csswg.org/css-scoping-1/#selectordef-slotted"}, "ca0abe12": {"dfnID":"ca0abe12","dfnText":"parse a list","external":true,"refSections":[{"refs":[{"id":"ref-for-css-parse-a-comma-separated-list-according-to-a-css-grammar"}],"title":"18.1. \n<forgiving-selector-list> and <forgiving-relative-selector-list>"}],"url":"https://drafts.csswg.org/css-syntax-3/#css-parse-a-comma-separated-list-according-to-a-css-grammar"}, "ca0c892d": {"dfnID":"ca0c892d","dfnText":"href","external":true,"refSections":[{"refs":[{"id":"ref-for-attr-hyperlink-href"}],"title":"8.1. \nThe Hyperlink Pseudo-class: :any-link"}],"url":"https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-href"}, "checked-pseudo": {"dfnID":"checked-pseudo","dfnText":":checked","external":false,"refSections":[{"refs":[{"id":"ref-for-checked-pseudo"},{"id":"ref-for-checked-pseudo\u2460"},{"id":"ref-for-checked-pseudo\u2461"}],"title":"13.2.1. \nThe Selected-option Pseudo-class: :checked"},{"refs":[{"id":"ref-for-checked-pseudo\u2462"}],"title":"13.2.2. \nThe Indeterminate-value Pseudo-class: :indeterminate"}],"url":"#checked-pseudo"}, "child-combinator": {"dfnID":"child-combinator","dfnText":"child combinator","external":false,"refSections":[{"refs":[{"id":"ref-for-child-combinator"}],"title":"3.1. \nStructure and Terminology"}],"url":"#child-combinator"}, "class-selector": {"dfnID":"class-selector","dfnText":"class selector","external":false,"refSections":[{"refs":[{"id":"ref-for-class-selector"}],"title":"3.1. \nStructure and Terminology"}],"url":"#class-selector"}, "column-combinator": {"dfnID":"column-combinator","dfnText":"column combinator","external":false,"refSections":[{"refs":[{"id":"ref-for-column-combinator"}],"title":"16. \nGrid-Structural Selectors"},{"refs":[{"id":"ref-for-column-combinator\u2460"}],"title":"20.6. \nChanges since the 29 September 2011 Working Draft"}],"url":"#column-combinator"}, "complex": {"dfnID":"complex","dfnText":"complex selector","external":false,"refSections":[{"refs":[{"id":"ref-for-complex"},{"id":"ref-for-complex\u2460"},{"id":"ref-for-complex\u2461"}],"title":"3.1. \nStructure and Terminology"},{"refs":[{"id":"ref-for-complex\u2462"}],"title":"3.2.1. \nFeatureless Elements"},{"refs":[{"id":"ref-for-complex\u2463"}],"title":"4.5. \nThe Relational Pseudo-class: :has()"},{"refs":[{"id":"ref-for-complex\u2464"}],"title":"14.3.1. \n:nth-child() pseudo-class"},{"refs":[{"id":"ref-for-complex\u2465"},{"id":"ref-for-complex\u2466"}],"title":"17. \nCalculating a selector\u2019s specificity"},{"refs":[{"id":"ref-for-complex\u2467"}],"title":"19.3. \nMatch a Selector Against an Element"},{"refs":[{"id":"ref-for-complex\u2468"},{"id":"ref-for-complex\u2460\u24ea"}],"title":"19.4. \nMatch a Selector Against a Pseudo-element"}],"url":"#complex"}, "compound": {"dfnID":"compound","dfnText":"compound selector","external":false,"refSections":[{"refs":[{"id":"ref-for-compound"},{"id":"ref-for-compound\u2460"},{"id":"ref-for-compound\u2461"},{"id":"ref-for-compound\u2462"},{"id":"ref-for-compound\u2463"},{"id":"ref-for-compound\u2464"}],"title":"2. \nSelectors Overview"},{"refs":[{"id":"ref-for-compound\u2465"},{"id":"ref-for-compound\u2466"},{"id":"ref-for-compound\u2467"},{"id":"ref-for-compound\u2468"},{"id":"ref-for-compound\u2460\u24ea"},{"id":"ref-for-compound\u2460\u2460"},{"id":"ref-for-compound\u2460\u2461"},{"id":"ref-for-compound\u2460\u2462"},{"id":"ref-for-compound\u2460\u2463"},{"id":"ref-for-compound\u2460\u2464"},{"id":"ref-for-compound\u2460\u2465"},{"id":"ref-for-compound\u2460\u2466"},{"id":"ref-for-compound\u2460\u2467"},{"id":"ref-for-compound\u2460\u2468"}],"title":"3.1. \nStructure and Terminology"},{"refs":[{"id":"ref-for-compound\u2461\u24ea"},{"id":"ref-for-compound\u2461\u2460"},{"id":"ref-for-compound\u2461\u2461"}],"title":"3.2.1. \nFeatureless Elements"},{"refs":[{"id":"ref-for-compound\u2461\u2462"},{"id":"ref-for-compound\u2461\u2463"}],"title":"3.5. \nPseudo-classes"},{"refs":[{"id":"ref-for-compound\u2461\u2464"},{"id":"ref-for-compound\u2461\u2465"}],"title":"3.6.2. \nBinding to the Document Tree"},{"refs":[{"id":"ref-for-compound\u2461\u2466"}],"title":"3.9. \nInvalid Selectors and Error Handling"},{"refs":[{"id":"ref-for-compound\u2461\u2467"},{"id":"ref-for-compound\u2461\u2468"},{"id":"ref-for-compound\u2462\u24ea"}],"title":"4. \nLogical Combinations"},{"refs":[{"id":"ref-for-compound\u2462\u2460"}],"title":"4.2. \nThe Matches-Any Pseudo-class: :is()"},{"refs":[{"id":"ref-for-compound\u2462\u2461"}],"title":"4.3. \nThe Negation (Matches-None) Pseudo-class: :not()"},{"refs":[{"id":"ref-for-compound\u2462\u2462"},{"id":"ref-for-compound\u2462\u2463"}],"title":"5.2. \nUniversal selector "},{"refs":[{"id":"ref-for-compound\u2462\u2464"}],"title":"5.3. \nNamespaces in Elemental Selectors"},{"refs":[{"id":"ref-for-compound\u2462\u2465"}],"title":"10.1. \nThe Current-element Pseudo-class: :current"},{"refs":[{"id":"ref-for-compound\u2462\u2466"}],"title":"15.1. \nDescendant combinator ( )"},{"refs":[{"id":"ref-for-compound\u2462\u2467"}],"title":"15.2. \nChild combinator (>)"},{"refs":[{"id":"ref-for-compound\u2462\u2468"},{"id":"ref-for-compound\u2463\u24ea"},{"id":"ref-for-compound\u2463\u2460"}],"title":"15.3. \nNext-sibling combinator (+)"},{"refs":[{"id":"ref-for-compound\u2463\u2461"},{"id":"ref-for-compound\u2463\u2462"}],"title":"15.4. \nSubsequent-sibling combinator (~)"},{"refs":[{"id":"ref-for-compound\u2463\u2463"}],"title":"19.3. \nMatch a Selector Against an Element"},{"refs":[{"id":"ref-for-compound\u2463\u2464"}],"title":"20.2. \nChanges since the 21 November 2018 Working Draft"}],"url":"#compound"}, "current-pseudo": {"dfnID":"current-pseudo","dfnText":":current","external":false,"refSections":[{"refs":[{"id":"ref-for-current-pseudo"}],"title":"2. \nSelectors Overview"},{"refs":[{"id":"ref-for-current-pseudo\u2460"},{"id":"ref-for-current-pseudo\u2461"},{"id":"ref-for-current-pseudo\u2462"}],"title":"10. \nTime-dimensional Pseudo-classes"},{"refs":[{"id":"ref-for-current-pseudo\u2463"},{"id":"ref-for-current-pseudo\u2464"},{"id":"ref-for-current-pseudo\u2465"},{"id":"ref-for-current-pseudo\u2466"}],"title":"10.1. \nThe Current-element Pseudo-class: :current"},{"refs":[{"id":"ref-for-current-pseudo\u2467"},{"id":"ref-for-current-pseudo\u2468"}],"title":"10.2. \nThe Past-element Pseudo-class: :past"},{"refs":[{"id":"ref-for-current-pseudo\u2460\u24ea"},{"id":"ref-for-current-pseudo\u2460\u2460"}],"title":"10.3. \nThe Future-element Pseudo-class: :future"}],"url":"#current-pseudo"}, "d056461c": {"dfnID":"d056461c","dfnText":":user-invalid","external":true,"refSections":[{"refs":[{"id":"ref-for-selector-user-invalid"}],"title":"13.3.5. \nThe User-interaction Pseudo-classes: :user-valid and :user-invalid"}],"url":"https://html.spec.whatwg.org/multipage/semantics-other.html#selector-user-invalid"}, "d7d642a2": {"dfnID":"d7d642a2","dfnText":"input","external":true,"refSections":[{"refs":[{"id":"ref-for-the-input-element"}],"title":"9.4. \nThe Focus-Indicated Pseudo-class: :focus-visible"},{"refs":[{"id":"ref-for-the-input-element\u2460"}],"title":"13. \nThe Input Pseudo-classes"},{"refs":[{"id":"ref-for-the-input-element\u2461"}],"title":"13.1.3. \nThe Placeholder-shown Pseudo-class: :placeholder-shown"},{"refs":[{"id":"ref-for-the-input-element\u2462"},{"id":"ref-for-the-input-element\u2463"}],"title":"13.3.5. \nThe User-interaction Pseudo-classes: :user-valid and :user-invalid"},{"refs":[{"id":"ref-for-the-input-element\u2464"}],"title":"\nAppendix B: Obsolete but Required -webkit- Parsing Quirks for Web Compat"}],"url":"https://html.spec.whatwg.org/multipage/input.html#the-input-element"}, "da60253e": {"dfnID":"da60253e","dfnText":"element definition","external":true,"refSections":[{"refs":[{"id":"ref-for-element-definition"}],"title":"5.4. \nThe Defined Pseudo-class: :defined"}],"url":"https://html.spec.whatwg.org/multipage/custom-elements.html#element-definition"}, "da8b8e0e": {"dfnID":"da8b8e0e","dfnText":"descendant","external":true,"refSections":[{"refs":[{"id":"ref-for-concept-tree-descendant"}],"title":"19.5. \nMatch a Selector Against a Tree"}],"url":"https://dom.spec.whatwg.org/#concept-tree-descendant"}, "de39d615": {"dfnID":"de39d615","dfnText":"default namespace","external":true,"refSections":[{"refs":[{"id":"ref-for-default-namespace"}],"title":"5.3. \nNamespaces in Elemental Selectors"}],"url":"https://drafts.csswg.org/css-namespaces-3/#default-namespace"}, "default-pseudo": {"dfnID":"default-pseudo","dfnText":":default","external":false,"refSections":[{"refs":[{"id":"ref-for-default-pseudo"},{"id":"ref-for-default-pseudo\u2460"},{"id":"ref-for-default-pseudo\u2461"}],"title":"13.1.5. \nThe Default-option Pseudo-class: :default"}],"url":"#default-pseudo"}, "defined-pseudo": {"dfnID":"defined-pseudo","dfnText":":defined","external":false,"refSections":[{"refs":[{"id":"ref-for-defined-pseudo"},{"id":"ref-for-defined-pseudo\u2460"},{"id":"ref-for-defined-pseudo\u2461"}],"title":"5.4. \nThe Defined Pseudo-class: :defined"},{"refs":[{"id":"ref-for-defined-pseudo\u2462"}],"title":"20.2. \nChanges since the 21 November 2018 Working Draft"}],"url":"#defined-pseudo"}, "descendant-combinator": {"dfnID":"descendant-combinator","dfnText":"descendant combinator","external":false,"refSections":[{"refs":[{"id":"ref-for-descendant-combinator"},{"id":"ref-for-descendant-combinator\u2460"}],"title":"3.1. \nStructure and Terminology"},{"refs":[{"id":"ref-for-descendant-combinator\u2461"}],"title":"3.4. \nRelative Selectors"}],"url":"#descendant-combinator"}, "df19338c": {"dfnID":"df19338c","dfnText":"box tree","external":true,"refSections":[{"refs":[{"id":"ref-for-box-tree"}],"title":"3.6.5. \nInternal Structure"}],"url":"https://drafts.csswg.org/css-display-4/#box-tree"}, "dir-pseudo": {"dfnID":"dir-pseudo","dfnText":":dir()","external":false,"refSections":[{"refs":[{"id":"ref-for-dir-pseudo"},{"id":"ref-for-dir-pseudo\u2460"},{"id":"ref-for-dir-pseudo\u2461"}],"title":"7.1. \nThe Directionality Pseudo-class: :dir()"},{"refs":[{"id":"ref-for-dir-pseudo\u2462"}],"title":"20.7. \nChanges Since Level 3"}],"url":"#dir-pseudo"}, "disabled-pseudo": {"dfnID":"disabled-pseudo","dfnText":":disabled","external":false,"refSections":[{"refs":[{"id":"ref-for-disabled-pseudo"},{"id":"ref-for-disabled-pseudo\u2460"},{"id":"ref-for-disabled-pseudo\u2461"},{"id":"ref-for-disabled-pseudo\u2462"}],"title":"13.1.1. \nThe :enabled and :disabled Pseudo-classes"}],"url":"#disabled-pseudo"}, "document-language": {"dfnID":"document-language","dfnText":"document language","external":false,"refSections":[{"refs":[{"id":"ref-for-document-language"}],"title":"3.1. \nStructure and Terminology"},{"refs":[{"id":"ref-for-document-language\u2460"}],"title":"3.2. \nData Model"},{"refs":[{"id":"ref-for-document-language\u2461"}],"title":"7.1. \nThe Directionality Pseudo-class: :dir()"}],"url":"#document-language"}, "e515eec3": {"dfnID":"e515eec3","dfnText":"::column","external":true,"refSections":[{"refs":[{"id":"ref-for-selectordef-column"}],"title":"20.4. \nChanges since the 2 May 2013 Working Draft"}],"url":"https://drafts.csswg.org/css-multicol-2/#selectordef-column"}, "e6cc3311": {"dfnID":"e6cc3311","dfnText":"tree","external":true,"refSections":[{"refs":[{"id":"ref-for-concept-tree"}],"title":"19.5. \nMatch a Selector Against a Tree"}],"url":"https://dom.spec.whatwg.org/#concept-tree"}, "ed948033": {"dfnID":"ed948033","dfnText":"fragment","external":true,"refSections":[{"refs":[{"id":"ref-for-concept-url-fragment"}],"title":"8.4. \nThe Target Pseudo-class: :target"}],"url":"https://url.spec.whatwg.org/#concept-url-fragment"}, "ee301461": {"dfnID":"ee301461","dfnText":"CSS qualified name","external":true,"refSections":[{"refs":[{"id":"ref-for-css-qualified-name"}],"title":"5.1. \nType (tag name) selector"},{"refs":[{"id":"ref-for-css-qualified-name\u2460"}],"title":"5.2. \nUniversal selector "},{"refs":[{"id":"ref-for-css-qualified-name\u2461"}],"title":"6.4. \nAttribute selectors and namespaces"}],"url":"https://drafts.csswg.org/css-namespaces-3/#css-qualified-name"}, "empty-pseudo": {"dfnID":"empty-pseudo","dfnText":":empty","external":false,"refSections":[{"refs":[{"id":"ref-for-empty-pseudo"},{"id":"ref-for-empty-pseudo\u2460"}],"title":"14.2. \n:empty pseudo-class"},{"refs":[{"id":"ref-for-empty-pseudo\u2461"}],"title":"20.3. \nChanges since the 2 February 2018 Working Draft"}],"url":"#empty-pseudo"}, "enabled-pseudo": {"dfnID":"enabled-pseudo","dfnText":":enabled","external":false,"refSections":[{"refs":[{"id":"ref-for-enabled-pseudo"},{"id":"ref-for-enabled-pseudo\u2460"},{"id":"ref-for-enabled-pseudo\u2461"},{"id":"ref-for-enabled-pseudo\u2462"}],"title":"13.1.1. \nThe :enabled and :disabled Pseudo-classes"}],"url":"#enabled-pseudo"}, "evaluating-selectors": {"dfnID":"evaluating-selectors","dfnText":"evaluating a selector","external":false,"refSections":[],"url":"#evaluating-selectors"}, "f0811ff8": {"dfnID":"f0811ff8","dfnText":"img","external":true,"refSections":[{"refs":[{"id":"ref-for-the-img-element"}],"title":"14.4.1. \n:nth-of-type() pseudo-class"},{"refs":[{"id":"ref-for-the-img-element\u2460"}],"title":"14.4.2. \n:nth-last-of-type() pseudo-class"}],"url":"https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element"}, "f29863d8": {"dfnID":"f29863d8","dfnText":"ol","external":true,"refSections":[{"refs":[{"id":"ref-for-the-ol-element"}],"title":"4.2. \nThe Matches-Any Pseudo-class: :is()"},{"refs":[{"id":"ref-for-the-ol-element\u2460"},{"id":"ref-for-the-ol-element\u2461"}],"title":"15.2. \nChild combinator (>)"}],"url":"https://html.spec.whatwg.org/multipage/grouping-content.html#the-ol-element"}, "f7960529": {"dfnID":"f7960529","dfnText":"root","external":true,"refSections":[{"refs":[{"id":"ref-for-concept-tree-root"}],"title":"19.5. \nMatch a Selector Against a Tree"}],"url":"https://dom.spec.whatwg.org/#concept-tree-root"}, "fc736137": {"dfnID":"fc736137","dfnText":"textarea","external":true,"refSections":[{"refs":[{"id":"ref-for-the-textarea-element"}],"title":"13.1.3. \nThe Placeholder-shown Pseudo-class: :placeholder-shown"}],"url":"https://html.spec.whatwg.org/multipage/form-elements.html#the-textarea-element"}, "fd0c9e35": {"dfnID":"fd0c9e35","dfnText":"::after","external":true,"refSections":[{"refs":[{"id":"ref-for-selectordef-after"}],"title":"3.6. Pseudo-elements"},{"refs":[{"id":"ref-for-selectordef-after\u2460"}],"title":"3.6.1. \nSyntax"},{"refs":[{"id":"ref-for-selectordef-after\u2461"}],"title":"18. \nGrammar"}],"url":"https://drafts.csswg.org/css-pseudo-4/#selectordef-after"}, "fd11cdcd": {"dfnID":"fd11cdcd","dfnText":"quirks mode","external":true,"refSections":[{"refs":[{"id":"ref-for-concept-document-quirks"}],"title":"6.6. \nClass selectors"},{"refs":[{"id":"ref-for-concept-document-quirks\u2460"}],"title":"6.7. \nID selectors"}],"url":"https://dom.spec.whatwg.org/#concept-document-quirks"}, "featureless": {"dfnID":"featureless","dfnText":"featureless","external":false,"refSections":[{"refs":[{"id":"ref-for-featureless"},{"id":"ref-for-featureless\u2460"},{"id":"ref-for-featureless\u2461"},{"id":"ref-for-featureless\u2462"},{"id":"ref-for-featureless\u2463"},{"id":"ref-for-featureless\u2464"}],"title":"3.2.1. \nFeatureless Elements"},{"refs":[{"id":"ref-for-featureless\u2465"}],"title":"3.6.1. \nSyntax"},{"refs":[{"id":"ref-for-featureless\u2466"},{"id":"ref-for-featureless\u2467"}],"title":"5.2. \nUniversal selector "},{"refs":[{"id":"ref-for-featureless\u2468"}],"title":"8.6. \nThe Reference Element Pseudo-class: :scope"}],"url":"#featureless"}, "fefa5851": {"dfnID":"fefa5851","dfnText":"shadow-including tree order","external":true,"refSections":[{"refs":[{"id":"ref-for-concept-shadow-including-tree-order"}],"title":"19.5. \nMatch a Selector Against a Tree"}],"url":"https://dom.spec.whatwg.org/#concept-shadow-including-tree-order"}, "first-child-pseudo": {"dfnID":"first-child-pseudo","dfnText":":first-child","external":false,"refSections":[{"refs":[{"id":"ref-for-first-child-pseudo"}],"title":"14.3.3. \n:first-child pseudo-class"},{"refs":[{"id":"ref-for-first-child-pseudo\u2460"}],"title":"15.2. \nChild combinator (>)"},{"refs":[{"id":"ref-for-first-child-pseudo\u2461"}],"title":"\nAppendix A: Guidance on Mapping Source Documents & Data to an Element Tree"}],"url":"#first-child-pseudo"}, "first-of-type-pseudo": {"dfnID":"first-of-type-pseudo","dfnText":":first-of-type","external":false,"refSections":[{"refs":[{"id":"ref-for-first-of-type-pseudo"}],"title":"14.4.3. \n:first-of-type pseudo-class"}],"url":"#first-of-type-pseudo"}, "focus-pseudo": {"dfnID":"focus-pseudo","dfnText":":focus","external":false,"refSections":[{"refs":[{"id":"ref-for-focus-pseudo"},{"id":"ref-for-focus-pseudo\u2460"}],"title":"3.6.3. \nPseudo-classing Pseudo-elements"},{"refs":[{"id":"ref-for-focus-pseudo\u2461"},{"id":"ref-for-focus-pseudo\u2462"},{"id":"ref-for-focus-pseudo\u2463"},{"id":"ref-for-focus-pseudo\u2464"},{"id":"ref-for-focus-pseudo\u2465"},{"id":"ref-for-focus-pseudo\u2466"}],"title":"9.3. \nThe Input Focus Pseudo-class: :focus"},{"refs":[{"id":"ref-for-focus-pseudo\u2467"},{"id":"ref-for-focus-pseudo\u2468"},{"id":"ref-for-focus-pseudo\u2460\u24ea"}],"title":"9.4. \nThe Focus-Indicated Pseudo-class: :focus-visible"},{"refs":[{"id":"ref-for-focus-pseudo\u2460\u2460"},{"id":"ref-for-focus-pseudo\u2460\u2461"}],"title":"9.5. \nThe Focus Container Pseudo-class: :focus-within"}],"url":"#focus-pseudo"}, "focus-visible-pseudo": {"dfnID":"focus-visible-pseudo","dfnText":":focus-visible","external":false,"refSections":[{"refs":[{"id":"ref-for-focus-visible-pseudo"},{"id":"ref-for-focus-visible-pseudo\u2460"},{"id":"ref-for-focus-visible-pseudo\u2461"},{"id":"ref-for-focus-visible-pseudo\u2462"},{"id":"ref-for-focus-visible-pseudo\u2463"}],"title":"9.4. \nThe Focus-Indicated Pseudo-class: :focus-visible"},{"refs":[{"id":"ref-for-focus-visible-pseudo\u2464"}],"title":"20.2. \nChanges since the 21 November 2018 Working Draft"},{"refs":[{"id":"ref-for-focus-visible-pseudo\u2465"}],"title":"20.3. \nChanges since the 2 February 2018 Working Draft"},{"refs":[{"id":"ref-for-focus-visible-pseudo\u2466"}],"title":"20.4. \nChanges since the 2 May 2013 Working Draft"},{"refs":[{"id":"ref-for-focus-visible-pseudo\u2467"}],"title":"20.7. \nChanges Since Level 3"}],"url":"#focus-visible-pseudo"}, "focus-within-pseudo": {"dfnID":"focus-within-pseudo","dfnText":":focus-within","external":false,"refSections":[{"refs":[{"id":"ref-for-focus-within-pseudo"}],"title":"9.3. \nThe Input Focus Pseudo-class: :focus"},{"refs":[{"id":"ref-for-focus-within-pseudo\u2460"}],"title":"9.5. \nThe Focus Container Pseudo-class: :focus-within"},{"refs":[{"id":"ref-for-focus-within-pseudo\u2461"}],"title":"20.4. \nChanges since the 2 May 2013 Working Draft"},{"refs":[{"id":"ref-for-focus-within-pseudo\u2462"}],"title":"20.7. \nChanges Since Level 3"}],"url":"#focus-within-pseudo"}, "functional-pseudo-class": {"dfnID":"functional-pseudo-class","dfnText":"functional pseudo-class","external":false,"refSections":[{"refs":[{"id":"ref-for-functional-pseudo-class"},{"id":"ref-for-functional-pseudo-class\u2460"}],"title":"3.5. \nPseudo-classes"}],"url":"#functional-pseudo-class"}, "functional-pseudo-element": {"dfnID":"functional-pseudo-element","dfnText":"functional pseudo-element","external":false,"refSections":[],"url":"#functional-pseudo-element"}, "future-pseudo": {"dfnID":"future-pseudo","dfnText":":future","external":false,"refSections":[{"refs":[{"id":"ref-for-future-pseudo"},{"id":"ref-for-future-pseudo\u2460"},{"id":"ref-for-future-pseudo\u2461"}],"title":"10. \nTime-dimensional Pseudo-classes"},{"refs":[{"id":"ref-for-future-pseudo\u2462"},{"id":"ref-for-future-pseudo\u2463"}],"title":"10.3. \nThe Future-element Pseudo-class: :future"}],"url":"#future-pseudo"}, "has-allowed-pseudo-element": {"dfnID":"has-allowed-pseudo-element","dfnText":":has-allowed pseudo-element","external":false,"refSections":[{"refs":[{"id":"ref-for-has-allowed-pseudo-element"}],"title":"4.5. \nThe Relational Pseudo-class: :has()"}],"url":"#has-allowed-pseudo-element"}, "has-pseudo": {"dfnID":"has-pseudo","dfnText":":has()","external":false,"refSections":[{"refs":[{"id":"ref-for-has-pseudo"},{"id":"ref-for-has-pseudo\u2460"}],"title":"3.2.1. \nFeatureless Elements"},{"refs":[{"id":"ref-for-has-pseudo\u2461"},{"id":"ref-for-has-pseudo\u2462"},{"id":"ref-for-has-pseudo\u2463"},{"id":"ref-for-has-pseudo\u2464"},{"id":"ref-for-has-pseudo\u2465"},{"id":"ref-for-has-pseudo\u2466"},{"id":"ref-for-has-pseudo\u2467"},{"id":"ref-for-has-pseudo\u2468"},{"id":"ref-for-has-pseudo\u2460\u24ea"}],"title":"4.5. \nThe Relational Pseudo-class: :has()"},{"refs":[{"id":"ref-for-has-pseudo\u2460\u2460"}],"title":"17. \nCalculating a selector\u2019s specificity"},{"refs":[{"id":"ref-for-has-pseudo\u2460\u2461"}],"title":"\nAppendix A: Guidance on Mapping Source Documents & Data to an Element Tree"},{"refs":[{"id":"ref-for-has-pseudo\u2460\u2462"},{"id":"ref-for-has-pseudo\u2460\u2463"},{"id":"ref-for-has-pseudo\u2460\u2464"},{"id":"ref-for-has-pseudo\u2460\u2465"}],"title":"20.1. \nChanges since the 7 May 2022 Working Draft"},{"refs":[{"id":"ref-for-has-pseudo\u2460\u2466"},{"id":"ref-for-has-pseudo\u2460\u2467"}],"title":"20.2. \nChanges since the 21 November 2018 Working Draft"},{"refs":[{"id":"ref-for-has-pseudo\u2460\u2468"}],"title":"20.3. \nChanges since the 2 February 2018 Working Draft"},{"refs":[{"id":"ref-for-has-pseudo\u2461\u24ea"}],"title":"20.4. \nChanges since the 2 May 2013 Working Draft"},{"refs":[{"id":"ref-for-has-pseudo\u2461\u2460"}],"title":"20.7. \nChanges Since Level 3"}],"url":"#has-pseudo"}, "host-language": {"dfnID":"host-language","dfnText":"host language","external":false,"refSections":[{"refs":[{"id":"ref-for-host-language"}],"title":"3.2. \nData Model"}],"url":"#host-language"}, "hover-pseudo": {"dfnID":"hover-pseudo","dfnText":":hover","external":false,"refSections":[{"refs":[{"id":"ref-for-hover-pseudo"}],"title":"3.6.3. \nPseudo-classing Pseudo-elements"},{"refs":[{"id":"ref-for-hover-pseudo\u2460"},{"id":"ref-for-hover-pseudo\u2461"},{"id":"ref-for-hover-pseudo\u2462"},{"id":"ref-for-hover-pseudo\u2463"},{"id":"ref-for-hover-pseudo\u2464"}],"title":"9.1. \nThe Pointer Hover Pseudo-class: :hover"}],"url":"#hover-pseudo"}, "id-selector": {"dfnID":"id-selector","dfnText":"ID selector","external":false,"refSections":[{"refs":[{"id":"ref-for-id-selector"}],"title":"3.1. \nStructure and Terminology"}],"url":"#id-selector"}, "in-range-pseudo": {"dfnID":"in-range-pseudo","dfnText":":in-range","external":false,"refSections":[{"refs":[{"id":"ref-for-in-range-pseudo"},{"id":"ref-for-in-range-pseudo\u2460"},{"id":"ref-for-in-range-pseudo\u2461"}],"title":"13.3.3. \nThe Range Pseudo-classes: :in-range and :out-of-range"}],"url":"#in-range-pseudo"}, "indeterminate-pseudo": {"dfnID":"indeterminate-pseudo","dfnText":":indeterminate","external":false,"refSections":[{"refs":[{"id":"ref-for-indeterminate-pseudo"},{"id":"ref-for-indeterminate-pseudo\u2460"},{"id":"ref-for-indeterminate-pseudo\u2461"},{"id":"ref-for-indeterminate-pseudo\u2462"}],"title":"13.2.2. \nThe Indeterminate-value Pseudo-class: :indeterminate"},{"refs":[{"id":"ref-for-indeterminate-pseudo\u2463"}],"title":"20.7. \nChanges Since Level 3"}],"url":"#indeterminate-pseudo"}, "indicate-focus": {"dfnID":"indicate-focus","dfnText":"indicate focus","external":false,"refSections":[{"refs":[{"id":"ref-for-indicate-focus"},{"id":"ref-for-indicate-focus\u2460"},{"id":"ref-for-indicate-focus\u2461"},{"id":"ref-for-indicate-focus\u2462"},{"id":"ref-for-indicate-focus\u2463"},{"id":"ref-for-indicate-focus\u2464"},{"id":"ref-for-indicate-focus\u2465"},{"id":"ref-for-indicate-focus\u2466"},{"id":"ref-for-indicate-focus\u2467"},{"id":"ref-for-indicate-focus\u2468"},{"id":"ref-for-indicate-focus\u2460\u24ea"}],"title":"9.4. \nThe Focus-Indicated Pseudo-class: :focus-visible"}],"url":"#indicate-focus"}, "invalid-pseudo": {"dfnID":"invalid-pseudo","dfnText":":invalid","external":false,"refSections":[{"refs":[{"id":"ref-for-invalid-pseudo"},{"id":"ref-for-invalid-pseudo\u2460"},{"id":"ref-for-invalid-pseudo\u2461"}],"title":"13.3.2. \nThe Validity Pseudo-classes: :valid and :invalid"},{"refs":[{"id":"ref-for-invalid-pseudo\u2462"},{"id":"ref-for-invalid-pseudo\u2463"},{"id":"ref-for-invalid-pseudo\u2464"}],"title":"13.3.5. \nThe User-interaction Pseudo-classes: :user-valid and :user-invalid"}],"url":"#invalid-pseudo"}, "invalid-selector": {"dfnID":"invalid-selector","dfnText":"invalid selectors","external":false,"refSections":[{"refs":[{"id":"ref-for-invalid-selector"}],"title":"3.6.3. \nPseudo-classing Pseudo-elements"},{"refs":[{"id":"ref-for-invalid-selector\u2460"},{"id":"ref-for-invalid-selector\u2461"}],"title":"3.9. \nInvalid Selectors and Error Handling"},{"refs":[{"id":"ref-for-invalid-selector\u2462"}],"title":"5.3. \nNamespaces in Elemental Selectors"},{"refs":[{"id":"ref-for-invalid-selector\u2463"}],"title":"18.1. \n<forgiving-selector-list> and <forgiving-relative-selector-list>"},{"refs":[{"id":"ref-for-invalid-selector\u2464"}],"title":"19. \nAPI Hooks"},{"refs":[{"id":"ref-for-invalid-selector\u2465"},{"id":"ref-for-invalid-selector\u2466"}],"title":"19.1. \nParse A Selector"},{"refs":[{"id":"ref-for-invalid-selector\u2467"},{"id":"ref-for-invalid-selector\u2468"}],"title":"19.2. \nParse A Relative Selector"}],"url":"#invalid-selector"}, "lang-pseudo": {"dfnID":"lang-pseudo","dfnText":":lang()","external":false,"refSections":[{"refs":[{"id":"ref-for-lang-pseudo"}],"title":"3.2. \nData Model"},{"refs":[{"id":"ref-for-lang-pseudo\u2460"}],"title":"3.5. \nPseudo-classes"},{"refs":[{"id":"ref-for-lang-pseudo\u2461"}],"title":"3.7. \nCharacters and case sensitivity"},{"refs":[{"id":"ref-for-lang-pseudo\u2462"}],"title":"6.1. \nAttribute presence and value selectors"},{"refs":[{"id":"ref-for-lang-pseudo\u2463"},{"id":"ref-for-lang-pseudo\u2464"}],"title":"7.2. \nThe Language Pseudo-class: :lang()"},{"refs":[{"id":"ref-for-lang-pseudo\u2465"}],"title":"20.4. \nChanges since the 2 May 2013 Working Draft"},{"refs":[{"id":"ref-for-lang-pseudo\u2466"}],"title":"20.7. \nChanges Since Level 3"}],"url":"#lang-pseudo"}, "language-range": {"dfnID":"language-range","dfnText":"language range","external":false,"refSections":[{"refs":[{"id":"ref-for-language-range"}],"title":"3.7. \nCharacters and case sensitivity"},{"refs":[{"id":"ref-for-language-range\u2460"},{"id":"ref-for-language-range\u2461"},{"id":"ref-for-language-range\u2462"},{"id":"ref-for-language-range\u2463"},{"id":"ref-for-language-range\u2464"},{"id":"ref-for-language-range\u2465"}],"title":"7.2. \nThe Language Pseudo-class: :lang()"}],"url":"#language-range"}, "last-child-pseudo": {"dfnID":"last-child-pseudo","dfnText":":last-child","external":false,"refSections":[{"refs":[{"id":"ref-for-last-child-pseudo"}],"title":"14.3.4. \n:last-child pseudo-class"}],"url":"#last-child-pseudo"}, "last-of-type-pseudo": {"dfnID":"last-of-type-pseudo","dfnText":":last-of-type","external":false,"refSections":[{"refs":[{"id":"ref-for-last-of-type-pseudo"}],"title":"14.4.4. \n:last-of-type pseudo-class"}],"url":"#last-of-type-pseudo"}, "legacy-selector-alias": {"dfnID":"legacy-selector-alias","dfnText":"legacy selector alias","external":false,"refSections":[{"refs":[{"id":"ref-for-legacy-selector-alias"}],"title":"4.2. \nThe Matches-Any Pseudo-class: :is()"},{"refs":[{"id":"ref-for-legacy-selector-alias\u2460"}],"title":"\nAppendix B: Obsolete but Required -webkit- Parsing Quirks for Web Compat"},{"refs":[{"id":"ref-for-legacy-selector-alias\u2461"}],"title":"20.1. \nChanges since the 7 May 2022 Working Draft"}],"url":"#legacy-selector-alias"}, "link-pseudo": {"dfnID":"link-pseudo","dfnText":":link","external":false,"refSections":[{"refs":[{"id":"ref-for-link-pseudo"}],"title":"8.1. \nThe Hyperlink Pseudo-class: :any-link"},{"refs":[{"id":"ref-for-link-pseudo\u2460"},{"id":"ref-for-link-pseudo\u2461"},{"id":"ref-for-link-pseudo\u2462"}],"title":"8.2. \nThe Link History Pseudo-classes: :link and :visited"}],"url":"#link-pseudo"}, "list-of-simple-selectors": {"dfnID":"list-of-simple-selectors","dfnText":"list of simple/compound/complex selectors","external":false,"refSections":[{"refs":[{"id":"ref-for-list-of-simple-selectors"}],"title":"3.1. \nStructure and Terminology"},{"refs":[{"id":"ref-for-list-of-simple-selectors\u2460"}],"title":"19.3. \nMatch a Selector Against an Element"}],"url":"#list-of-simple-selectors"}, "local-link-pseudo": {"dfnID":"local-link-pseudo","dfnText":":local-link","external":false,"refSections":[{"refs":[{"id":"ref-for-local-link-pseudo"},{"id":"ref-for-local-link-pseudo\u2460"}],"title":"8.3. \nThe Local Link Pseudo-class: :local-link"},{"refs":[{"id":"ref-for-local-link-pseudo\u2461"}],"title":"20.7. \nChanges Since Level 3"}],"url":"#local-link-pseudo"}, "logical-combination-pseudo-classes": {"dfnID":"logical-combination-pseudo-classes","dfnText":"logical combination pseudo-classes","external":false,"refSections":[{"refs":[{"id":"ref-for-logical-combination-pseudo-classes"}],"title":"3.2.1. \nFeatureless Elements"},{"refs":[{"id":"ref-for-logical-combination-pseudo-classes\u2460"},{"id":"ref-for-logical-combination-pseudo-classes\u2461"}],"title":"3.6.3. \nPseudo-classing Pseudo-elements"},{"refs":[{"id":"ref-for-logical-combination-pseudo-classes\u2462"}],"title":"4. \nLogical Combinations"}],"url":"#logical-combination-pseudo-classes"}, "match": {"dfnID":"match","dfnText":"matching","external":false,"refSections":[{"refs":[{"id":"ref-for-match"},{"id":"ref-for-match\u2460"},{"id":"ref-for-match\u2461"},{"id":"ref-for-match\u2462"},{"id":"ref-for-match\u2463"},{"id":"ref-for-match\u2464"},{"id":"ref-for-match\u2465"}],"title":"3.1. \nStructure and Terminology"},{"refs":[{"id":"ref-for-match\u2466"}],"title":"19. \nAPI Hooks"}],"url":"#match"}, "match-a-complex-selector-against-an-element": {"dfnID":"match-a-complex-selector-against-an-element","dfnText":"match a complex selector against an element","external":false,"refSections":[{"refs":[{"id":"ref-for-match-a-complex-selector-against-an-element"}],"title":"19.4. \nMatch a Selector Against a Pseudo-element"}],"url":"#match-a-complex-selector-against-an-element"}, "match-a-selector-against-a-pseudo-element": {"dfnID":"match-a-selector-against-a-pseudo-element","dfnText":"match a selector against a pseudo-element","external":false,"refSections":[{"refs":[{"id":"ref-for-match-a-selector-against-a-pseudo-element"}],"title":"19.5. \nMatch a Selector Against a Tree"}],"url":"#match-a-selector-against-a-pseudo-element"}, "match-a-selector-against-a-tree": {"dfnID":"match-a-selector-against-a-tree","dfnText":"match a selector against a tree","external":false,"refSections":[{"refs":[{"id":"ref-for-match-a-selector-against-a-tree"}],"title":"20.4. \nChanges since the 2 May 2013 Working Draft"}],"url":"#match-a-selector-against-a-tree"}, "match-a-selector-against-an-element": {"dfnID":"match-a-selector-against-an-element","dfnText":"match a selector against an element","external":false,"refSections":[{"refs":[{"id":"ref-for-match-a-selector-against-an-element"}],"title":"19.4. \nMatch a Selector Against a Pseudo-element"},{"refs":[{"id":"ref-for-match-a-selector-against-an-element\u2460"}],"title":"19.5. \nMatch a Selector Against a Tree"}],"url":"#match-a-selector-against-an-element"}, "matches-pseudo": {"dfnID":"matches-pseudo","dfnText":":is()","external":false,"refSections":[{"refs":[{"id":"ref-for-matches-pseudo"},{"id":"ref-for-matches-pseudo\u2460"},{"id":"ref-for-matches-pseudo\u2461"},{"id":"ref-for-matches-pseudo\u2462"}],"title":"4. \nLogical Combinations"},{"refs":[{"id":"ref-for-matches-pseudo\u2463"},{"id":"ref-for-matches-pseudo\u2464"},{"id":"ref-for-matches-pseudo\u2465"},{"id":"ref-for-matches-pseudo\u2466"},{"id":"ref-for-matches-pseudo\u2467"},{"id":"ref-for-matches-pseudo\u2468"},{"id":"ref-for-matches-pseudo\u2460\u24ea"},{"id":"ref-for-matches-pseudo\u2460\u2460"}],"title":"4.2. \nThe Matches-Any Pseudo-class: :is()"},{"refs":[{"id":"ref-for-matches-pseudo\u2460\u2461"},{"id":"ref-for-matches-pseudo\u2460\u2462"}],"title":"4.3. \nThe Negation (Matches-None) Pseudo-class: :not()"},{"refs":[{"id":"ref-for-matches-pseudo\u2460\u2463"},{"id":"ref-for-matches-pseudo\u2460\u2464"}],"title":"4.4. \nThe Specificity-adjustment Pseudo-class: :where()"},{"refs":[{"id":"ref-for-matches-pseudo\u2460\u2465"}],"title":"10.1. \nThe Current-element Pseudo-class: :current"},{"refs":[{"id":"ref-for-matches-pseudo\u2460\u2466"}],"title":"17. \nCalculating a selector\u2019s specificity"},{"refs":[{"id":"ref-for-matches-pseudo\u2460\u2467"},{"id":"ref-for-matches-pseudo\u2460\u2468"},{"id":"ref-for-matches-pseudo\u2461\u24ea"},{"id":"ref-for-matches-pseudo\u2461\u2460"}],"title":"18.1. \n<forgiving-selector-list> and <forgiving-relative-selector-list>"},{"refs":[{"id":"ref-for-matches-pseudo\u2461\u2461"}],"title":"\nAppendix A: Guidance on Mapping Source Documents & Data to an Element Tree"},{"refs":[{"id":"ref-for-matches-pseudo\u2461\u2462"}],"title":"20.2. \nChanges since the 21 November 2018 Working Draft"},{"refs":[{"id":"ref-for-matches-pseudo\u2461\u2463"},{"id":"ref-for-matches-pseudo\u2461\u2464"}],"title":"20.3. \nChanges since the 2 February 2018 Working Draft"},{"refs":[{"id":"ref-for-matches-pseudo\u2461\u2465"}],"title":"20.7. \nChanges Since Level 3"}],"url":"#matches-pseudo"}, "negation-pseudo": {"dfnID":"negation-pseudo","dfnText":":not()","external":false,"refSections":[{"refs":[{"id":"ref-for-negation-pseudo"}],"title":"4. \nLogical Combinations"},{"refs":[{"id":"ref-for-negation-pseudo\u2460"},{"id":"ref-for-negation-pseudo\u2461"},{"id":"ref-for-negation-pseudo\u2462"},{"id":"ref-for-negation-pseudo\u2463"},{"id":"ref-for-negation-pseudo\u2464"},{"id":"ref-for-negation-pseudo\u2465"}],"title":"4.3. \nThe Negation (Matches-None) Pseudo-class: :not()"},{"refs":[{"id":"ref-for-negation-pseudo\u2466"}],"title":"14.4.2. \n:nth-last-of-type() pseudo-class"},{"refs":[{"id":"ref-for-negation-pseudo\u2467"}],"title":"17. \nCalculating a selector\u2019s specificity"},{"refs":[{"id":"ref-for-negation-pseudo\u2468"}],"title":"20.4. \nChanges since the 2 May 2013 Working Draft"},{"refs":[{"id":"ref-for-negation-pseudo\u2460\u24ea"}],"title":"20.5. \nChanges since the 23 August 2012 Working Draft"},{"refs":[{"id":"ref-for-negation-pseudo\u2460\u2460"}],"title":"20.7. \nChanges Since Level 3"}],"url":"#negation-pseudo"}, "next-sibling-combinator": {"dfnID":"next-sibling-combinator","dfnText":"next-sibling combinator","external":false,"refSections":[{"refs":[{"id":"ref-for-next-sibling-combinator"}],"title":"3.1. \nStructure and Terminology"}],"url":"#next-sibling-combinator"}, "nsdecl": {"dfnID":"nsdecl","dfnText":"declared","external":false,"refSections":[{"refs":[{"id":"ref-for-nsdecl"},{"id":"ref-for-nsdecl"},{"id":"ref-for-nsdecl"}],"title":"5.3. \nNamespaces in Elemental Selectors"},{"refs":[{"id":"ref-for-nsdecl"},{"id":"ref-for-nsdecl\u2460"}],"title":"6.4. \nAttribute selectors and namespaces"}],"url":"#nsdecl"}, "nth-child-pseudo": {"dfnID":"nth-child-pseudo","dfnText":":nth-child(An+B [of S]? )","external":false,"refSections":[{"refs":[{"id":"ref-for-nth-child-pseudo"},{"id":"ref-for-nth-child-pseudo\u2460"}],"title":"14.3.1. \n:nth-child() pseudo-class"},{"refs":[{"id":"ref-for-nth-child-pseudo\u2461"}],"title":"14.3.2. \n:nth-last-child() pseudo-class"},{"refs":[{"id":"ref-for-nth-child-pseudo\u2462"}],"title":"14.4.1. \n:nth-of-type() pseudo-class"},{"refs":[{"id":"ref-for-nth-child-pseudo\u2463"}],"title":"17. \nCalculating a selector\u2019s specificity"},{"refs":[{"id":"ref-for-nth-child-pseudo\u2464"}],"title":"\nAppendix A: Guidance on Mapping Source Documents & Data to an Element Tree"},{"refs":[{"id":"ref-for-nth-child-pseudo\u2465"},{"id":"ref-for-nth-child-pseudo\u2466"}],"title":"20.1. \nChanges since the 7 May 2022 Working Draft"},{"refs":[{"id":"ref-for-nth-child-pseudo\u2467"},{"id":"ref-for-nth-child-pseudo\u2468"}],"title":"20.2. \nChanges since the 21 November 2018 Working Draft"},{"refs":[{"id":"ref-for-nth-child-pseudo\u2460\u24ea"}],"title":"20.3. \nChanges since the 2 February 2018 Working Draft"}],"url":"#nth-child-pseudo"}, "nth-col-pseudo": {"dfnID":"nth-col-pseudo","dfnText":":nth-col(An+B)","external":false,"refSections":[{"refs":[{"id":"ref-for-nth-col-pseudo"}],"title":"16. \nGrid-Structural Selectors"},{"refs":[{"id":"ref-for-nth-col-pseudo\u2460"}],"title":"16.2. \n:nth-col() pseudo-class"},{"refs":[{"id":"ref-for-nth-col-pseudo\u2461"}],"title":"20.4. \nChanges since the 2 May 2013 Working Draft"}],"url":"#nth-col-pseudo"}, "nth-last-child-pseudo": {"dfnID":"nth-last-child-pseudo","dfnText":":nth-last-child(An+B [of S]? )","external":false,"refSections":[{"refs":[{"id":"ref-for-nth-last-child-pseudo"},{"id":"ref-for-nth-last-child-pseudo\u2460"}],"title":"14.3.2. \n:nth-last-child() pseudo-class"},{"refs":[{"id":"ref-for-nth-last-child-pseudo\u2461"}],"title":"17. \nCalculating a selector\u2019s specificity"},{"refs":[{"id":"ref-for-nth-last-child-pseudo\u2462"}],"title":"20.1. \nChanges since the 7 May 2022 Working Draft"},{"refs":[{"id":"ref-for-nth-last-child-pseudo\u2463"},{"id":"ref-for-nth-last-child-pseudo\u2464"}],"title":"20.2. \nChanges since the 21 November 2018 Working Draft"}],"url":"#nth-last-child-pseudo"}, "nth-last-col-pseudo": {"dfnID":"nth-last-col-pseudo","dfnText":":nth-last-col(An+B)","external":false,"refSections":[{"refs":[{"id":"ref-for-nth-last-col-pseudo"}],"title":"16. \nGrid-Structural Selectors"},{"refs":[{"id":"ref-for-nth-last-col-pseudo\u2460"}],"title":"16.3. \n:nth-last-col() pseudo-class"},{"refs":[{"id":"ref-for-nth-last-col-pseudo\u2461"}],"title":"20.4. \nChanges since the 2 May 2013 Working Draft"}],"url":"#nth-last-col-pseudo"}, "nth-last-of-type-pseudo": {"dfnID":"nth-last-of-type-pseudo","dfnText":":nth-last-of-type(An+B)","external":false,"refSections":[{"refs":[{"id":"ref-for-nth-last-of-type-pseudo"}],"title":"14.4.2. \n:nth-last-of-type() pseudo-class"}],"url":"#nth-last-of-type-pseudo"}, "nth-of-type-pseudo": {"dfnID":"nth-of-type-pseudo","dfnText":":nth-of-type(An+B)","external":false,"refSections":[{"refs":[{"id":"ref-for-nth-of-type-pseudo"}],"title":"14.4.1. \n:nth-of-type() pseudo-class"}],"url":"#nth-of-type-pseudo"}, "only-child-pseudo": {"dfnID":"only-child-pseudo","dfnText":":only-child","external":false,"refSections":[{"refs":[{"id":"ref-for-only-child-pseudo"}],"title":"14.3.5. \n:only-child pseudo-class"}],"url":"#only-child-pseudo"}, "only-of-type-pseudo": {"dfnID":"only-of-type-pseudo","dfnText":":only-of-type","external":false,"refSections":[{"refs":[{"id":"ref-for-only-of-type-pseudo"}],"title":"14.4.5. \n:only-of-type pseudo-class"}],"url":"#only-of-type-pseudo"}, "optional-pseudo": {"dfnID":"optional-pseudo","dfnText":":optional","external":false,"refSections":[{"refs":[{"id":"ref-for-optional-pseudo"}],"title":"13.3.4. \nThe Optionality Pseudo-classes: :required and :optional"}],"url":"#optional-pseudo"}, "originating-element": {"dfnID":"originating-element","dfnText":"originating element","external":false,"refSections":[{"refs":[{"id":"ref-for-originating-element"},{"id":"ref-for-originating-element\u2460"},{"id":"ref-for-originating-element\u2461"},{"id":"ref-for-originating-element\u2462"}],"title":"3.1. \nStructure and Terminology"},{"refs":[{"id":"ref-for-originating-element\u2463"}],"title":"3.6. Pseudo-elements"},{"refs":[{"id":"ref-for-originating-element\u2464"},{"id":"ref-for-originating-element\u2465"},{"id":"ref-for-originating-element\u2466"}],"title":"3.6.2. \nBinding to the Document Tree"},{"refs":[{"id":"ref-for-originating-element\u2467"}],"title":"3.6.4. \nSub-pseudo-elements"}],"url":"#originating-element"}, "originating-pseudo-element": {"dfnID":"originating-pseudo-element","dfnText":"originating pseudo-element","external":false,"refSections":[{"refs":[{"id":"ref-for-originating-pseudo-element"}],"title":"3.6.4. \nSub-pseudo-elements"}],"url":"#originating-pseudo-element"}, "out-of-range-pseudo": {"dfnID":"out-of-range-pseudo","dfnText":":out-of-range","external":false,"refSections":[{"refs":[{"id":"ref-for-out-of-range-pseudo"},{"id":"ref-for-out-of-range-pseudo\u2460"},{"id":"ref-for-out-of-range-pseudo\u2461"}],"title":"13.3.3. \nThe Range Pseudo-classes: :in-range and :out-of-range"}],"url":"#out-of-range-pseudo"}, "parse-a-relative-selector": {"dfnID":"parse-a-relative-selector","dfnText":"parse a relative selector","external":false,"refSections":[],"url":"#parse-a-relative-selector"}, "parse-a-selector": {"dfnID":"parse-a-selector","dfnText":"parse a selector","external":false,"refSections":[],"url":"#parse-a-selector"}, "parse-as-a-forgiving-selector-list": {"dfnID":"parse-as-a-forgiving-selector-list","dfnText":"parse as a forgiving selector list","external":false,"refSections":[{"refs":[{"id":"ref-for-parse-as-a-forgiving-selector-list"}],"title":"18.1. \n<forgiving-selector-list> and <forgiving-relative-selector-list>"}],"url":"#parse-as-a-forgiving-selector-list"}, "past-pseudo": {"dfnID":"past-pseudo","dfnText":":past","external":false,"refSections":[{"refs":[{"id":"ref-for-past-pseudo"},{"id":"ref-for-past-pseudo\u2460"},{"id":"ref-for-past-pseudo\u2461"}],"title":"10. \nTime-dimensional Pseudo-classes"},{"refs":[{"id":"ref-for-past-pseudo\u2462"},{"id":"ref-for-past-pseudo\u2463"}],"title":"10.2. \nThe Past-element Pseudo-class: :past"}],"url":"#past-pseudo"}, "placeholder-shown-pseudo": {"dfnID":"placeholder-shown-pseudo","dfnText":":placeholder-shown","external":false,"refSections":[{"refs":[{"id":"ref-for-placeholder-shown-pseudo"},{"id":"ref-for-placeholder-shown-pseudo\u2460"}],"title":"13.1.3. \nThe Placeholder-shown Pseudo-class: :placeholder-shown"},{"refs":[{"id":"ref-for-placeholder-shown-pseudo\u2461"}],"title":"20.2. \nChanges since the 21 November 2018 Working Draft"},{"refs":[{"id":"ref-for-placeholder-shown-pseudo\u2462"}],"title":"20.5. \nChanges since the 23 August 2012 Working Draft"}],"url":"#placeholder-shown-pseudo"}, "pseudo-class": {"dfnID":"pseudo-class","dfnText":"Pseudo-classes","external":false,"refSections":[{"refs":[{"id":"ref-for-pseudo-class"},{"id":"ref-for-pseudo-class\u2460"},{"id":"ref-for-pseudo-class\u2461"}],"title":"3.1. \nStructure and Terminology"},{"refs":[{"id":"ref-for-pseudo-class\u2462"}],"title":"3.2.1. \nFeatureless Elements"},{"refs":[{"id":"ref-for-pseudo-class\u2463"},{"id":"ref-for-pseudo-class\u2464"},{"id":"ref-for-pseudo-class\u2465"},{"id":"ref-for-pseudo-class\u2466"},{"id":"ref-for-pseudo-class\u2467"},{"id":"ref-for-pseudo-class\u2468"},{"id":"ref-for-pseudo-class\u2460\u24ea"}],"title":"3.5. \nPseudo-classes"},{"refs":[{"id":"ref-for-pseudo-class\u2460\u2460"},{"id":"ref-for-pseudo-class\u2460\u2461"}],"title":"3.6. Pseudo-elements"},{"refs":[{"id":"ref-for-pseudo-class\u2460\u2462"},{"id":"ref-for-pseudo-class\u2460\u2463"}],"title":"3.6.3. \nPseudo-classing Pseudo-elements"},{"refs":[{"id":"ref-for-pseudo-class\u2460\u2464"},{"id":"ref-for-pseudo-class\u2460\u2465"}],"title":"4. \nLogical Combinations"},{"refs":[{"id":"ref-for-pseudo-class\u2460\u2466"}],"title":"5.4. \nThe Defined Pseudo-class: :defined"},{"refs":[{"id":"ref-for-pseudo-class\u2460\u2467"},{"id":"ref-for-pseudo-class\u2460\u2468"}],"title":"9.4. \nThe Focus-Indicated Pseudo-class: :focus-visible"},{"refs":[{"id":"ref-for-pseudo-class\u2461\u24ea"}],"title":"14.4.1. \n:nth-of-type() pseudo-class"},{"refs":[{"id":"ref-for-pseudo-class\u2461\u2460"}],"title":"14.4.2. \n:nth-last-of-type() pseudo-class"}],"url":"#pseudo-class"}, "pseudo-compound": {"dfnID":"pseudo-compound","dfnText":"pseudo-compound selector","external":false,"refSections":[{"refs":[{"id":"ref-for-pseudo-compound"},{"id":"ref-for-pseudo-compound\u2460"},{"id":"ref-for-pseudo-compound\u2461"},{"id":"ref-for-pseudo-compound\u2462"},{"id":"ref-for-pseudo-compound\u2463"},{"id":"ref-for-pseudo-compound\u2464"},{"id":"ref-for-pseudo-compound\u2465"},{"id":"ref-for-pseudo-compound\u2466"},{"id":"ref-for-pseudo-compound\u2467"},{"id":"ref-for-pseudo-compound\u2468"}],"title":"3.1. \nStructure and Terminology"}],"url":"#pseudo-compound"}, "pseudo-element": {"dfnID":"pseudo-element","dfnText":"pseudo-element","external":false,"refSections":[{"refs":[{"id":"ref-for-pseudo-element\u2460"},{"id":"ref-for-pseudo-element\u2461"},{"id":"ref-for-pseudo-element\u2462"}],"title":"3.1. \nStructure and Terminology"},{"refs":[{"id":"ref-for-pseudo-element\u2463"},{"id":"ref-for-pseudo-element\u2464"},{"id":"ref-for-pseudo-element\u2465"}],"title":"3.6. Pseudo-elements"},{"refs":[{"id":"ref-for-pseudo-element\u2466"},{"id":"ref-for-pseudo-element\u2467"},{"id":"ref-for-pseudo-element\u2468"},{"id":"ref-for-pseudo-element\u2460\u24ea"},{"id":"ref-for-pseudo-element\u2460\u2460"},{"id":"ref-for-pseudo-element\u2460\u2461"}],"title":"3.6.1. \nSyntax"},{"refs":[{"id":"ref-for-pseudo-element\u2460\u2462"},{"id":"ref-for-pseudo-element\u2460\u2463"},{"id":"ref-for-pseudo-element\u2460\u2464"},{"id":"ref-for-pseudo-element\u2460\u2465"},{"id":"ref-for-pseudo-element\u2460\u2466"},{"id":"ref-for-pseudo-element\u2460\u2467"}],"title":"3.6.2. \nBinding to the Document Tree"},{"refs":[{"id":"ref-for-pseudo-element\u2460\u2468"},{"id":"ref-for-pseudo-element\u2461\u24ea"},{"id":"ref-for-pseudo-element\u2461\u2460"},{"id":"ref-for-pseudo-element\u2461\u2461"}],"title":"3.6.3. \nPseudo-classing Pseudo-elements"},{"refs":[{"id":"ref-for-pseudo-element\u2461\u2462"},{"id":"ref-for-pseudo-element\u2461\u2463"},{"id":"ref-for-pseudo-element\u2461\u2464"}],"title":"3.6.4. \nSub-pseudo-elements"},{"refs":[{"id":"ref-for-pseudo-element\u2461\u2465"},{"id":"ref-for-pseudo-element\u2461\u2466"},{"id":"ref-for-pseudo-element\u2461\u2467"}],"title":"3.6.5. \nInternal Structure"},{"refs":[{"id":"ref-for-pseudo-element\u2461\u2468"}],"title":"4.5. \nThe Relational Pseudo-class: :has()"},{"refs":[{"id":"ref-for-pseudo-element\u2462\u24ea"}],"title":"14. \nTree-Structural pseudo-classes"},{"refs":[{"id":"ref-for-pseudo-element\u2462\u2460"},{"id":"ref-for-pseudo-element\u2462\u2461"}],"title":"18. \nGrammar"},{"refs":[{"id":"ref-for-pseudo-element\u2462\u2462"}],"title":"19.5. \nMatch a Selector Against a Tree"},{"refs":[{"id":"ref-for-pseudo-element\u2462\u2463"}],"title":"\nAppendix B: Obsolete but Required -webkit- Parsing Quirks for Web Compat"},{"refs":[{"id":"ref-for-pseudo-element\u2462\u2464"}],"title":"20.1. \nChanges since the 7 May 2022 Working Draft"}],"url":"#pseudo-element"}, "read-only-pseudo": {"dfnID":"read-only-pseudo","dfnText":":read-only","external":false,"refSections":[{"refs":[{"id":"ref-for-read-only-pseudo"}],"title":"13.1.2. \nThe Mutability Pseudo-classes: :read-only and :read-write"}],"url":"#read-only-pseudo"}, "read-write-pseudo": {"dfnID":"read-write-pseudo","dfnText":":read-write","external":false,"refSections":[{"refs":[{"id":"ref-for-read-write-pseudo"},{"id":"ref-for-read-write-pseudo\u2460"}],"title":"13.1.2. \nThe Mutability Pseudo-classes: :read-only and :read-write"},{"refs":[{"id":"ref-for-read-write-pseudo\u2461"}],"title":"20.1. \nChanges since the 7 May 2022 Working Draft"}],"url":"#read-write-pseudo"}, "relative-selector": {"dfnID":"relative-selector","dfnText":"relative selectors","external":false,"refSections":[{"refs":[{"id":"ref-for-relative-selector"}],"title":"2. \nSelectors Overview"},{"refs":[{"id":"ref-for-relative-selector\u2460"}],"title":"4.5. \nThe Relational Pseudo-class: :has()"},{"refs":[{"id":"ref-for-relative-selector\u2461"}],"title":"20.4. \nChanges since the 2 May 2013 Working Draft"}],"url":"#relative-selector"}, "relative-selector-anchor-elements": {"dfnID":"relative-selector-anchor-elements","dfnText":"relative selector anchor elements","external":false,"refSections":[{"refs":[{"id":"ref-for-relative-selector-anchor-elements"}],"title":"2. \nSelectors Overview"},{"refs":[{"id":"ref-for-relative-selector-anchor-elements\u2460"}],"title":"3.4. \nRelative Selectors"},{"refs":[{"id":"ref-for-relative-selector-anchor-elements\u2461"}],"title":"4.5. \nThe Relational Pseudo-class: :has()"}],"url":"#relative-selector-anchor-elements"}, "required-pseudo": {"dfnID":"required-pseudo","dfnText":":required","external":false,"refSections":[{"refs":[{"id":"ref-for-required-pseudo"}],"title":"13.3.4. \nThe Optionality Pseudo-classes: :required and :optional"}],"url":"#required-pseudo"}, "root-pseudo": {"dfnID":"root-pseudo","dfnText":":root","external":false,"refSections":[{"refs":[{"id":"ref-for-root-pseudo"}],"title":"8.6. \nThe Reference Element Pseudo-class: :scope"},{"refs":[{"id":"ref-for-root-pseudo\u2460"},{"id":"ref-for-root-pseudo\u2461"}],"title":"14.1. \n:root pseudo-class"},{"refs":[{"id":"ref-for-root-pseudo\u2462"}],"title":"\nAppendix A: Guidance on Mapping Source Documents & Data to an Element Tree"}],"url":"#root-pseudo"}, "scope-pseudo": {"dfnID":"scope-pseudo","dfnText":":scope","external":false,"refSections":[{"refs":[{"id":"ref-for-scope-pseudo"},{"id":"ref-for-scope-pseudo\u2460"}],"title":"8.6. \nThe Reference Element Pseudo-class: :scope"},{"refs":[{"id":"ref-for-scope-pseudo\u2461"}],"title":"19.3. \nMatch a Selector Against an Element"},{"refs":[{"id":"ref-for-scope-pseudo\u2462"}],"title":"20.7. \nChanges Since Level 3"}],"url":"#scope-pseudo"}, "scoped-selector": {"dfnID":"scoped-selector","dfnText":"scope","external":false,"refSections":[{"refs":[{"id":"ref-for-scoped-selector"},{"id":"ref-for-scoped-selector\u2460"}],"title":"3.3. \nScoped Selectors"},{"refs":[{"id":"ref-for-scoped-selector\u2461"}],"title":"19.5. \nMatch a Selector Against a Tree"},{"refs":[{"id":"ref-for-scoped-selector\u2462"}],"title":"20.4. \nChanges since the 2 May 2013 Working Draft"}],"url":"#scoped-selector"}, "scoping-root": {"dfnID":"scoping-root","dfnText":"scoping root","external":false,"refSections":[{"refs":[{"id":"ref-for-scoping-root"}],"title":"2. \nSelectors Overview"},{"refs":[{"id":"ref-for-scoping-root\u2460"}],"title":"3.3. \nScoped Selectors"},{"refs":[{"id":"ref-for-scoping-root\u2461"},{"id":"ref-for-scoping-root\u2462"},{"id":"ref-for-scoping-root\u2463"},{"id":"ref-for-scoping-root\u2464"},{"id":"ref-for-scoping-root\u2465"},{"id":"ref-for-scoping-root\u2466"},{"id":"ref-for-scoping-root\u2467"}],"title":"8.6. \nThe Reference Element Pseudo-class: :scope"},{"refs":[{"id":"ref-for-scoping-root\u2468"}],"title":"19.3. \nMatch a Selector Against an Element"},{"refs":[{"id":"ref-for-scoping-root\u2460\u24ea"},{"id":"ref-for-scoping-root\u2460\u2460"},{"id":"ref-for-scoping-root\u2460\u2461"}],"title":"19.5. \nMatch a Selector Against a Tree"}],"url":"#scoping-root"}, "selector": {"dfnID":"selector","dfnText":"selector","external":false,"refSections":[{"refs":[{"id":"ref-for-selector\u2460"}],"title":"1. \nIntroduction"},{"refs":[{"id":"ref-for-selector\u2461"},{"id":"ref-for-selector\u2462"},{"id":"ref-for-selector\u2463"}],"title":"3.1. \nStructure and Terminology"}],"url":"#selector"}, "selector-combinator": {"dfnID":"selector-combinator","dfnText":"combinator","external":false,"refSections":[{"refs":[{"id":"ref-for-selector-combinator"},{"id":"ref-for-selector-combinator\u2460"},{"id":"ref-for-selector-combinator\u2461"},{"id":"ref-for-selector-combinator\u2462"},{"id":"ref-for-selector-combinator\u2463"},{"id":"ref-for-selector-combinator\u2464"}],"title":"3.1. \nStructure and Terminology"},{"refs":[{"id":"ref-for-selector-combinator\u2465"}],"title":"3.4. \nRelative Selectors"},{"refs":[{"id":"ref-for-selector-combinator\u2466"}],"title":"3.6.5. \nInternal Structure"},{"refs":[{"id":"ref-for-selector-combinator\u2467"}],"title":"19.3. \nMatch a Selector Against an Element"}],"url":"#selector-combinator"}, "selector-list": {"dfnID":"selector-list","dfnText":"selector list","external":false,"refSections":[{"refs":[{"id":"ref-for-selector-list"},{"id":"ref-for-selector-list\u2460"},{"id":"ref-for-selector-list\u2461"},{"id":"ref-for-selector-list\u2462"}],"title":"3.1. \nStructure and Terminology"},{"refs":[{"id":"ref-for-selector-list\u2463"}],"title":"3.2.1. \nFeatureless Elements"},{"refs":[{"id":"ref-for-selector-list\u2464"}],"title":"4. \nLogical Combinations"},{"refs":[{"id":"ref-for-selector-list\u2465"},{"id":"ref-for-selector-list\u2466"}],"title":"4.1. \nSelector Lists"},{"refs":[{"id":"ref-for-selector-list\u2467"}],"title":"14.3.1. \n:nth-child() pseudo-class"},{"refs":[{"id":"ref-for-selector-list\u2468"}],"title":"14.3.2. \n:nth-last-child() pseudo-class"},{"refs":[{"id":"ref-for-selector-list\u2460\u24ea"},{"id":"ref-for-selector-list\u2460\u2460"},{"id":"ref-for-selector-list\u2460\u2461"}],"title":"17. \nCalculating a selector\u2019s specificity"},{"refs":[{"id":"ref-for-selector-list\u2460\u2462"}],"title":"20.4. \nChanges since the 2 May 2013 Working Draft"}],"url":"#selector-list"}, "selector-subject": {"dfnID":"selector-subject","dfnText":"subject of a selector","external":false,"refSections":[{"refs":[{"id":"ref-for-selector-subject"}],"title":"3.2.1. \nFeatureless Elements"},{"refs":[{"id":"ref-for-selector-subject\u2460"}],"title":"4.2. \nThe Matches-Any Pseudo-class: :is()"},{"refs":[{"id":"ref-for-selector-subject\u2461"}],"title":"4.3. \nThe Negation (Matches-None) Pseudo-class: :not()"},{"refs":[{"id":"ref-for-selector-subject\u2462"},{"id":"ref-for-selector-subject\u2463"}],"title":"8.6. \nThe Reference Element Pseudo-class: :scope"}],"url":"#selector-subject"}, "selectordef-adjacent": {"dfnID":"selectordef-adjacent","dfnText":"+","external":false,"refSections":[],"url":"#selectordef-adjacent"}, "selectordef-autofill": {"dfnID":"selectordef-autofill","dfnText":":autofill","external":false,"refSections":[{"refs":[{"id":"ref-for-selectordef-autofill"}],"title":"13.1.4. \nThe Automatic Input Pseudo-class: :autofill"},{"refs":[{"id":"ref-for-selectordef-autofill\u2460"}],"title":"\nAppendix B: Obsolete but Required -webkit- Parsing Quirks for Web Compat"},{"refs":[{"id":"ref-for-selectordef-autofill\u2461"}],"title":"20.2. \nChanges since the 21 November 2018 Working Draft"},{"refs":[{"id":"ref-for-selectordef-autofill\u2462"}],"title":"Privacy Considerations"}],"url":"#selectordef-autofill"}, "selectordef-buffering": {"dfnID":"selectordef-buffering","dfnText":":buffering","external":false,"refSections":[{"refs":[{"id":"ref-for-selectordef-buffering"},{"id":"ref-for-selectordef-buffering\u2460"},{"id":"ref-for-selectordef-buffering\u2461"}],"title":"11.2. \nMedia Loading State: the :buffering and :stalled pseudo-classes"},{"refs":[{"id":"ref-for-selectordef-buffering\u2462"}],"title":"20.2. \nChanges since the 21 November 2018 Working Draft"}],"url":"#selectordef-buffering"}, "selectordef-child": {"dfnID":"selectordef-child","dfnText":">","external":false,"refSections":[{"refs":[{"id":"ref-for-selectordef-child"},{"id":"ref-for-selectordef-child\u2460"}],"title":"3.1. \nStructure and Terminology"}],"url":"#selectordef-child"}, "selectordef-closed": {"dfnID":"selectordef-closed","dfnText":":closed","external":false,"refSections":[{"refs":[{"id":"ref-for-selectordef-closed"}],"title":"12.1. \nCollapse State: the :open and :closed pseudo-class"},{"refs":[{"id":"ref-for-selectordef-closed\u2460"}],"title":"20.1. \nChanges since the 7 May 2022 Working Draft"}],"url":"#selectordef-closed"}, "selectordef-column": {"dfnID":"selectordef-column","dfnText":"||","external":false,"refSections":[],"url":"#selectordef-column"}, "selectordef-current": {"dfnID":"selectordef-current","dfnText":":current()","external":false,"refSections":[],"url":"#selectordef-current"}, "selectordef-fullscreen": {"dfnID":"selectordef-fullscreen","dfnText":":fullscreen","external":false,"refSections":[{"refs":[{"id":"ref-for-selectordef-fullscreen"}],"title":"12.2. \nModal (Exclusive Interaction) State: the :modal pseudo-class"},{"refs":[{"id":"ref-for-selectordef-fullscreen\u2460"}],"title":"12.3. \nFullscreen Presentation State: the :fullscreen pseudo-class"},{"refs":[{"id":"ref-for-selectordef-fullscreen\u2461"}],"title":"20.2. \nChanges since the 21 November 2018 Working Draft"}],"url":"#selectordef-fullscreen"}, "selectordef-matches": {"dfnID":"selectordef-matches","dfnText":":matches()","external":false,"refSections":[{"refs":[{"id":"ref-for-selectordef-matches"}],"title":"20.3. \nChanges since the 2 February 2018 Working Draft"},{"refs":[{"id":"ref-for-selectordef-matches\u2460"},{"id":"ref-for-selectordef-matches\u2461"}],"title":"20.4. \nChanges since the 2 May 2013 Working Draft"},{"refs":[{"id":"ref-for-selectordef-matches\u2462"},{"id":"ref-for-selectordef-matches\u2463"}],"title":"20.5. \nChanges since the 23 August 2012 Working Draft"}],"url":"#selectordef-matches"}, "selectordef-modal": {"dfnID":"selectordef-modal","dfnText":":modal","external":false,"refSections":[{"refs":[{"id":"ref-for-selectordef-modal"},{"id":"ref-for-selectordef-modal\u2460"},{"id":"ref-for-selectordef-modal\u2461"},{"id":"ref-for-selectordef-modal\u2462"}],"title":"12.2. \nModal (Exclusive Interaction) State: the :modal pseudo-class"},{"refs":[{"id":"ref-for-selectordef-modal\u2463"}],"title":"20.2. \nChanges since the 21 November 2018 Working Draft"}],"url":"#selectordef-modal"}, "selectordef-muted": {"dfnID":"selectordef-muted","dfnText":":muted","external":false,"refSections":[{"refs":[{"id":"ref-for-selectordef-muted"}],"title":"11.3. \nSound State: the :muted and :volume-locked pseudo-classes"},{"refs":[{"id":"ref-for-selectordef-muted\u2460"}],"title":"20.2. \nChanges since the 21 November 2018 Working Draft"}],"url":"#selectordef-muted"}, "selectordef-open": {"dfnID":"selectordef-open","dfnText":":open","external":false,"refSections":[{"refs":[{"id":"ref-for-selectordef-open"},{"id":"ref-for-selectordef-open\u2460"}],"title":"12.1. \nCollapse State: the :open and :closed pseudo-class"},{"refs":[{"id":"ref-for-selectordef-open\u2461"}],"title":"20.1. \nChanges since the 7 May 2022 Working Draft"}],"url":"#selectordef-open"}, "selectordef-paused": {"dfnID":"selectordef-paused","dfnText":":paused","external":false,"refSections":[{"refs":[{"id":"ref-for-selectordef-paused"}],"title":"11.1. \nMedia Playback State: the :playing, :paused, and :seeking pseudo-classes"},{"refs":[{"id":"ref-for-selectordef-paused\u2460"}],"title":"20.4. \nChanges since the 2 May 2013 Working Draft"}],"url":"#selectordef-paused"}, "selectordef-picture-in-picture": {"dfnID":"selectordef-picture-in-picture","dfnText":":picture-in-picture","external":false,"refSections":[{"refs":[{"id":"ref-for-selectordef-picture-in-picture"}],"title":"12.4. \nPicture-in-Picture Presentation State: the :picture-in-picture pseudo-class"},{"refs":[{"id":"ref-for-selectordef-picture-in-picture\u2460"}],"title":"20.2. \nChanges since the 21 November 2018 Working Draft"}],"url":"#selectordef-picture-in-picture"}, "selectordef-playing": {"dfnID":"selectordef-playing","dfnText":":playing","external":false,"refSections":[{"refs":[{"id":"ref-for-selectordef-playing"}],"title":"11.1. \nMedia Playback State: the :playing, :paused, and :seeking pseudo-classes"},{"refs":[{"id":"ref-for-selectordef-playing\u2460"},{"id":"ref-for-selectordef-playing\u2461"}],"title":"11.2. \nMedia Loading State: the :buffering and :stalled pseudo-classes"},{"refs":[{"id":"ref-for-selectordef-playing\u2462"}],"title":"20.4. \nChanges since the 2 May 2013 Working Draft"}],"url":"#selectordef-playing"}, "selectordef-seeking": {"dfnID":"selectordef-seeking","dfnText":":seeking","external":false,"refSections":[{"refs":[{"id":"ref-for-selectordef-seeking"}],"title":"11.1. \nMedia Playback State: the :playing, :paused, and :seeking pseudo-classes"},{"refs":[{"id":"ref-for-selectordef-seeking\u2460"}],"title":"20.2. \nChanges since the 21 November 2018 Working Draft"}],"url":"#selectordef-seeking"}, "selectordef-sibling": {"dfnID":"selectordef-sibling","dfnText":"~","external":false,"refSections":[],"url":"#selectordef-sibling"}, "selectordef-stalled": {"dfnID":"selectordef-stalled","dfnText":":stalled","external":false,"refSections":[{"refs":[{"id":"ref-for-selectordef-stalled"},{"id":"ref-for-selectordef-stalled\u2460"}],"title":"11.2. \nMedia Loading State: the :buffering and :stalled pseudo-classes"},{"refs":[{"id":"ref-for-selectordef-stalled\u2461"}],"title":"20.2. \nChanges since the 21 November 2018 Working Draft"}],"url":"#selectordef-stalled"}, "selectordef-volume-locked": {"dfnID":"selectordef-volume-locked","dfnText":":volume-locked","external":false,"refSections":[{"refs":[{"id":"ref-for-selectordef-volume-locked"}],"title":"11.3. \nSound State: the :muted and :volume-locked pseudo-classes"},{"refs":[{"id":"ref-for-selectordef-volume-locked\u2460"}],"title":"20.2. \nChanges since the 21 November 2018 Working Draft"}],"url":"#selectordef-volume-locked"}, "simple": {"dfnID":"simple","dfnText":"simple selector","external":false,"refSections":[{"refs":[{"id":"ref-for-simple"},{"id":"ref-for-simple\u2460"},{"id":"ref-for-simple\u2461"},{"id":"ref-for-simple\u2462"},{"id":"ref-for-simple\u2463"},{"id":"ref-for-simple\u2464"},{"id":"ref-for-simple\u2465"},{"id":"ref-for-simple\u2466"}],"title":"3.1. \nStructure and Terminology"},{"refs":[{"id":"ref-for-simple\u2467"},{"id":"ref-for-simple\u2468"},{"id":"ref-for-simple\u2460\u24ea"},{"id":"ref-for-simple\u2460\u2460"}],"title":"3.2.1. \nFeatureless Elements"},{"refs":[{"id":"ref-for-simple\u2460\u2461"},{"id":"ref-for-simple\u2460\u2462"}],"title":"3.5. \nPseudo-classes"},{"refs":[{"id":"ref-for-simple\u2460\u2463"}],"title":"4.3. \nThe Negation (Matches-None) Pseudo-class: :not()"},{"refs":[{"id":"ref-for-simple\u2460\u2464"}],"title":"5.2. \nUniversal selector "},{"refs":[{"id":"ref-for-simple\u2460\u2465"}],"title":"19.4. \nMatch a Selector Against a Pseudo-element"}],"url":"#simple"}, "specificity": {"dfnID":"specificity","dfnText":"specificity","external":false,"refSections":[{"refs":[{"id":"ref-for-specificity"},{"id":"ref-for-specificity\u2460"}],"title":"4.4. \nThe Specificity-adjustment Pseudo-class: :where()"},{"refs":[{"id":"ref-for-specificity\u2461"}],"title":"20.4. \nChanges since the 2 May 2013 Working Draft"},{"refs":[{"id":"ref-for-specificity\u2462"}],"title":"20.5. \nChanges since the 23 August 2012 Working Draft"}],"url":"#specificity"}, "structural-pseudo-classes": {"dfnID":"structural-pseudo-classes","dfnText":"structural pseudo-classes","external":false,"refSections":[{"refs":[{"id":"ref-for-structural-pseudo-classes"}],"title":"3.6. Pseudo-elements"},{"refs":[{"id":"ref-for-structural-pseudo-classes\u2460"}],"title":"14. \nTree-Structural pseudo-classes"}],"url":"#structural-pseudo-classes"}, "sub-pseudo-element": {"dfnID":"sub-pseudo-element","dfnText":"sub-pseudo-elements","external":false,"refSections":[{"refs":[{"id":"ref-for-sub-pseudo-element"},{"id":"ref-for-sub-pseudo-element\u2460"},{"id":"ref-for-sub-pseudo-element\u2461"}],"title":"3.6.4. \nSub-pseudo-elements"},{"refs":[{"id":"ref-for-sub-pseudo-element\u2462"}],"title":"20.2. \nChanges since the 21 November 2018 Working Draft"}],"url":"#sub-pseudo-element"}, "subsequent-sibling-combinator": {"dfnID":"subsequent-sibling-combinator","dfnText":"subsequent-sibling combinator","external":false,"refSections":[{"refs":[{"id":"ref-for-subsequent-sibling-combinator"}],"title":"3.1. \nStructure and Terminology"}],"url":"#subsequent-sibling-combinator"}, "target-pseudo": {"dfnID":"target-pseudo","dfnText":":target","external":false,"refSections":[{"refs":[{"id":"ref-for-target-pseudo"}],"title":"8.3. \nThe Local Link Pseudo-class: :local-link"},{"refs":[{"id":"ref-for-target-pseudo\u2460"},{"id":"ref-for-target-pseudo\u2461"}],"title":"8.4. \nThe Target Pseudo-class: :target"},{"refs":[{"id":"ref-for-target-pseudo\u2462"},{"id":"ref-for-target-pseudo\u2463"}],"title":"8.5. \nThe Target Container Pseudo-class: :target-within"}],"url":"#target-pseudo"}, "target-within-pseudo": {"dfnID":"target-within-pseudo","dfnText":":target-within","external":false,"refSections":[{"refs":[{"id":"ref-for-target-within-pseudo"}],"title":"8.3. \nThe Local Link Pseudo-class: :local-link"},{"refs":[{"id":"ref-for-target-within-pseudo\u2460"}],"title":"8.5. \nThe Target Container Pseudo-class: :target-within"},{"refs":[{"id":"ref-for-target-within-pseudo\u2461"}],"title":"20.4. \nChanges since the 2 May 2013 Working Draft"},{"refs":[{"id":"ref-for-target-within-pseudo\u2462"}],"title":"20.7. \nChanges Since Level 3"}],"url":"#target-within-pseudo"}, "type-selector": {"dfnID":"type-selector","dfnText":"type selector","external":false,"refSections":[{"refs":[{"id":"ref-for-type-selector"},{"id":"ref-for-type-selector\u2460"}],"title":"3.1. \nStructure and Terminology"},{"refs":[{"id":"ref-for-type-selector\u2461"}],"title":"3.5. \nPseudo-classes"},{"refs":[{"id":"ref-for-type-selector\u2462"}],"title":"4.2. \nThe Matches-Any Pseudo-class: :is()"},{"refs":[{"id":"ref-for-type-selector\u2463"}],"title":"4.3. \nThe Negation (Matches-None) Pseudo-class: :not()"},{"refs":[{"id":"ref-for-type-selector\u2464"}],"title":"5.1. \nType (tag name) selector"},{"refs":[{"id":"ref-for-type-selector\u2465"},{"id":"ref-for-type-selector\u2466"},{"id":"ref-for-type-selector\u2467"}],"title":"5.2. \nUniversal selector "},{"refs":[{"id":"ref-for-type-selector\u2468"},{"id":"ref-for-type-selector\u2460\u24ea"},{"id":"ref-for-type-selector\u2460\u2460"}],"title":"5.3. \nNamespaces in Elemental Selectors"},{"refs":[{"id":"ref-for-type-selector\u2460\u2461"}],"title":"14.4.1. \n:nth-of-type() pseudo-class"},{"refs":[{"id":"ref-for-type-selector\u2460\u2462"}],"title":"14.4.2. \n:nth-last-of-type() pseudo-class"}],"url":"#type-selector"}, "typedef-attr-matcher": {"dfnID":"typedef-attr-matcher","dfnText":"<attr-matcher>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-attr-matcher"},{"id":"ref-for-typedef-attr-matcher\u2460"}],"title":"18. \nGrammar"}],"url":"#typedef-attr-matcher"}, "typedef-attr-modifier": {"dfnID":"typedef-attr-modifier","dfnText":"<attr-modifier>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-attr-modifier"}],"title":"18. \nGrammar"}],"url":"#typedef-attr-modifier"}, "typedef-attribute-selector": {"dfnID":"typedef-attribute-selector","dfnText":"<attribute-selector>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-attribute-selector"}],"title":"18. \nGrammar"}],"url":"#typedef-attribute-selector"}, "typedef-class-selector": {"dfnID":"typedef-class-selector","dfnText":"<class-selector>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-class-selector"},{"id":"ref-for-typedef-class-selector\u2460"}],"title":"18. \nGrammar"}],"url":"#typedef-class-selector"}, "typedef-combinator": {"dfnID":"typedef-combinator","dfnText":"<combinator>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-combinator"},{"id":"ref-for-typedef-combinator\u2460"},{"id":"ref-for-typedef-combinator\u2461"},{"id":"ref-for-typedef-combinator\u2462"},{"id":"ref-for-typedef-combinator\u2463"},{"id":"ref-for-typedef-combinator\u2464"}],"title":"18. \nGrammar"},{"refs":[{"id":"ref-for-typedef-combinator\u2465"}],"title":"20.2. \nChanges since the 21 November 2018 Working Draft"}],"url":"#typedef-combinator"}, "typedef-complex-real-selector": {"dfnID":"typedef-complex-real-selector","dfnText":"<complex-real-selector>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-complex-real-selector"},{"id":"ref-for-typedef-complex-real-selector\u2460"}],"title":"18. \nGrammar"},{"refs":[{"id":"ref-for-typedef-complex-real-selector\u2461"}],"title":"18.1. \n<forgiving-selector-list> and <forgiving-relative-selector-list>"}],"url":"#typedef-complex-real-selector"}, "typedef-complex-real-selector-list": {"dfnID":"typedef-complex-real-selector-list","dfnText":"<complex-real-selector-list>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-complex-real-selector-list"}],"title":"4.3. \nThe Negation (Matches-None) Pseudo-class: :not()"},{"refs":[{"id":"ref-for-typedef-complex-real-selector-list\u2460"}],"title":"14.3.1. \n:nth-child() pseudo-class"},{"refs":[{"id":"ref-for-typedef-complex-real-selector-list\u2461"}],"title":"14.3.2. \n:nth-last-child() pseudo-class"}],"url":"#typedef-complex-real-selector-list"}, "typedef-complex-selector": {"dfnID":"typedef-complex-selector","dfnText":"<complex-selector>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-complex-selector"}],"title":"3.1. \nStructure and Terminology"},{"refs":[{"id":"ref-for-typedef-complex-selector\u2460"},{"id":"ref-for-typedef-complex-selector\u2461"},{"id":"ref-for-typedef-complex-selector\u2462"}],"title":"18. \nGrammar"}],"url":"#typedef-complex-selector"}, "typedef-complex-selector-list": {"dfnID":"typedef-complex-selector-list","dfnText":"<complex-selector-list>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-complex-selector-list"}],"title":"18. \nGrammar"}],"url":"#typedef-complex-selector-list"}, "typedef-complex-selector-unit": {"dfnID":"typedef-complex-selector-unit","dfnText":"<complex-selector-unit>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-complex-selector-unit"},{"id":"ref-for-typedef-complex-selector-unit\u2460"},{"id":"ref-for-typedef-complex-selector-unit\u2461"},{"id":"ref-for-typedef-complex-selector-unit\u2462"},{"id":"ref-for-typedef-complex-selector-unit\u2463"}],"title":"18. \nGrammar"}],"url":"#typedef-complex-selector-unit"}, "typedef-compound-selector": {"dfnID":"typedef-compound-selector","dfnText":"<compound-selector>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-compound-selector"}],"title":"3.1. \nStructure and Terminology"},{"refs":[{"id":"ref-for-typedef-compound-selector\u2460"},{"id":"ref-for-typedef-compound-selector\u2461"},{"id":"ref-for-typedef-compound-selector\u2462"},{"id":"ref-for-typedef-compound-selector\u2463"},{"id":"ref-for-typedef-compound-selector\u2464"},{"id":"ref-for-typedef-compound-selector\u2465"},{"id":"ref-for-typedef-compound-selector\u2466"}],"title":"18. \nGrammar"},{"refs":[{"id":"ref-for-typedef-compound-selector\u2467"}],"title":"20.2. \nChanges since the 21 November 2018 Working Draft"}],"url":"#typedef-compound-selector"}, "typedef-compound-selector-list": {"dfnID":"typedef-compound-selector-list","dfnText":"<compound-selector-list>","external":false,"refSections":[],"url":"#typedef-compound-selector-list"}, "typedef-forgiving-selector-list": {"dfnID":"typedef-forgiving-selector-list","dfnText":"<forgiving-selector-list>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-forgiving-selector-list"}],"title":"4.2. \nThe Matches-Any Pseudo-class: :is()"},{"refs":[{"id":"ref-for-typedef-forgiving-selector-list\u2460"},{"id":"ref-for-typedef-forgiving-selector-list\u2461"},{"id":"ref-for-typedef-forgiving-selector-list\u2462"},{"id":"ref-for-typedef-forgiving-selector-list\u2463"},{"id":"ref-for-typedef-forgiving-selector-list\u2464"},{"id":"ref-for-typedef-forgiving-selector-list\u2465"}],"title":"18.1. \n<forgiving-selector-list> and <forgiving-relative-selector-list>"}],"url":"#typedef-forgiving-selector-list"}, "typedef-id-selector": {"dfnID":"typedef-id-selector","dfnText":"<id-selector>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-id-selector"},{"id":"ref-for-typedef-id-selector\u2460"}],"title":"18. \nGrammar"}],"url":"#typedef-id-selector"}, "typedef-legacy-pseudo-element-selector": {"dfnID":"typedef-legacy-pseudo-element-selector","dfnText":"<legacy-pseudo-element-selector>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-legacy-pseudo-element-selector"},{"id":"ref-for-typedef-legacy-pseudo-element-selector\u2460"}],"title":"18. \nGrammar"}],"url":"#typedef-legacy-pseudo-element-selector"}, "typedef-ns-prefix": {"dfnID":"typedef-ns-prefix","dfnText":"<ns-prefix>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-ns-prefix"},{"id":"ref-for-typedef-ns-prefix\u2460"}],"title":"18. \nGrammar"}],"url":"#typedef-ns-prefix"}, "typedef-pseudo-class-selector": {"dfnID":"typedef-pseudo-class-selector","dfnText":"<pseudo-class-selector>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-pseudo-class-selector"},{"id":"ref-for-typedef-pseudo-class-selector\u2460"},{"id":"ref-for-typedef-pseudo-class-selector\u2461"},{"id":"ref-for-typedef-pseudo-class-selector\u2462"},{"id":"ref-for-typedef-pseudo-class-selector\u2463"},{"id":"ref-for-typedef-pseudo-class-selector\u2464"},{"id":"ref-for-typedef-pseudo-class-selector\u2465"},{"id":"ref-for-typedef-pseudo-class-selector\u2466"}],"title":"18. \nGrammar"}],"url":"#typedef-pseudo-class-selector"}, "typedef-pseudo-compound-selector": {"dfnID":"typedef-pseudo-compound-selector","dfnText":"<pseudo-compound-selector>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-pseudo-compound-selector"}],"title":"3.1. \nStructure and Terminology"},{"refs":[{"id":"ref-for-typedef-pseudo-compound-selector\u2460"},{"id":"ref-for-typedef-pseudo-compound-selector\u2461"}],"title":"18. \nGrammar"}],"url":"#typedef-pseudo-compound-selector"}, "typedef-pseudo-element-selector": {"dfnID":"typedef-pseudo-element-selector","dfnText":"<pseudo-element-selector>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-pseudo-element-selector"},{"id":"ref-for-typedef-pseudo-element-selector\u2460"},{"id":"ref-for-typedef-pseudo-element-selector\u2461"},{"id":"ref-for-typedef-pseudo-element-selector\u2462"},{"id":"ref-for-typedef-pseudo-element-selector\u2463"}],"title":"18. \nGrammar"}],"url":"#typedef-pseudo-element-selector"}, "typedef-relative-real-selector": {"dfnID":"typedef-relative-real-selector","dfnText":"<relative-real-selector>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-relative-real-selector"}],"title":"18. \nGrammar"}],"url":"#typedef-relative-real-selector"}, "typedef-relative-real-selector-list": {"dfnID":"typedef-relative-real-selector-list","dfnText":"<relative-real-selector-list>","external":false,"refSections":[],"url":"#typedef-relative-real-selector-list"}, "typedef-relative-selector": {"dfnID":"typedef-relative-selector","dfnText":"<relative-selector>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-relative-selector"}],"title":"3.4. \nRelative Selectors"},{"refs":[{"id":"ref-for-typedef-relative-selector\u2460"}],"title":"18. \nGrammar"}],"url":"#typedef-relative-selector"}, "typedef-relative-selector-list": {"dfnID":"typedef-relative-selector-list","dfnText":"<relative-selector-list>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-relative-selector-list"}],"title":"3.4. \nRelative Selectors"},{"refs":[{"id":"ref-for-typedef-relative-selector-list\u2460"},{"id":"ref-for-typedef-relative-selector-list\u2461"}],"title":"4.5. \nThe Relational Pseudo-class: :has()"},{"refs":[{"id":"ref-for-typedef-relative-selector-list\u2462"}],"title":"19.2. \nParse A Relative Selector"}],"url":"#typedef-relative-selector-list"}, "typedef-selector-list": {"dfnID":"typedef-selector-list","dfnText":"<selector-list>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-selector-list"}],"title":"18.1. \n<forgiving-selector-list> and <forgiving-relative-selector-list>"},{"refs":[{"id":"ref-for-typedef-selector-list\u2460"}],"title":"19.1. \nParse A Selector"}],"url":"#typedef-selector-list"}, "typedef-simple-selector": {"dfnID":"typedef-simple-selector","dfnText":"<simple-selector>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-simple-selector"}],"title":"3.1. \nStructure and Terminology"},{"refs":[{"id":"ref-for-typedef-simple-selector\u2460"}],"title":"18. \nGrammar"}],"url":"#typedef-simple-selector"}, "typedef-simple-selector-list": {"dfnID":"typedef-simple-selector-list","dfnText":"<simple-selector-list>","external":false,"refSections":[],"url":"#typedef-simple-selector-list"}, "typedef-subclass-selector": {"dfnID":"typedef-subclass-selector","dfnText":"<subclass-selector>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-subclass-selector"},{"id":"ref-for-typedef-subclass-selector\u2460"},{"id":"ref-for-typedef-subclass-selector\u2461"}],"title":"18. \nGrammar"}],"url":"#typedef-subclass-selector"}, "typedef-type-selector": {"dfnID":"typedef-type-selector","dfnText":"<type-selector>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-type-selector"},{"id":"ref-for-typedef-type-selector\u2460"},{"id":"ref-for-typedef-type-selector\u2461"},{"id":"ref-for-typedef-type-selector\u2462"}],"title":"18. \nGrammar"}],"url":"#typedef-type-selector"}, "typedef-wq-name": {"dfnID":"typedef-wq-name","dfnText":"<wq-name>","external":false,"refSections":[{"refs":[{"id":"ref-for-typedef-wq-name"},{"id":"ref-for-typedef-wq-name\u2460"},{"id":"ref-for-typedef-wq-name\u2461"},{"id":"ref-for-typedef-wq-name\u2462"}],"title":"18. \nGrammar"}],"url":"#typedef-wq-name"}, "ultimate-originating-element": {"dfnID":"ultimate-originating-element","dfnText":"ultimate originating element","external":false,"refSections":[],"url":"#ultimate-originating-element"}, "universal-selector": {"dfnID":"universal-selector","dfnText":"universal selector","external":false,"refSections":[{"refs":[{"id":"ref-for-universal-selector"},{"id":"ref-for-universal-selector\u2460"},{"id":"ref-for-universal-selector\u2461"}],"title":"3.1. \nStructure and Terminology"},{"refs":[{"id":"ref-for-universal-selector\u2462"}],"title":"3.5. \nPseudo-classes"},{"refs":[{"id":"ref-for-universal-selector\u2463"}],"title":"3.6.2. \nBinding to the Document Tree"},{"refs":[{"id":"ref-for-universal-selector\u2464"}],"title":"4.2. \nThe Matches-Any Pseudo-class: :is()"},{"refs":[{"id":"ref-for-universal-selector\u2465"}],"title":"4.3. \nThe Negation (Matches-None) Pseudo-class: :not()"},{"refs":[{"id":"ref-for-universal-selector\u2466"},{"id":"ref-for-universal-selector\u2467"},{"id":"ref-for-universal-selector\u2468"},{"id":"ref-for-universal-selector\u2460\u24ea"},{"id":"ref-for-universal-selector\u2460\u2460"}],"title":"5.2. \nUniversal selector "},{"refs":[{"id":"ref-for-universal-selector\u2460\u2461"},{"id":"ref-for-universal-selector\u2460\u2462"}],"title":"5.3. \nNamespaces in Elemental Selectors"}],"url":"#universal-selector"}, "unknown--webkit--pseudo-elements": {"dfnID":"unknown--webkit--pseudo-elements","dfnText":"unknown -webkit- pseudo-elements","external":false,"refSections":[{"refs":[{"id":"ref-for-unknown--webkit--pseudo-elements"}],"title":"\nAppendix B: Obsolete but Required -webkit- Parsing Quirks for Web Compat"}],"url":"#unknown--webkit--pseudo-elements"}, "user-action-pseudo-class": {"dfnID":"user-action-pseudo-class","dfnText":"user action pseudo-classes","external":false,"refSections":[{"refs":[{"id":"ref-for-user-action-pseudo-class\u2460"}],"title":"3.6.3. \nPseudo-classing Pseudo-elements"},{"refs":[{"id":"ref-for-user-action-pseudo-class\u2461"}],"title":"18. \nGrammar"}],"url":"#user-action-pseudo-class"}, "user-invalid-pseudo": {"dfnID":"user-invalid-pseudo","dfnText":":user-invalid","external":false,"refSections":[{"refs":[{"id":"ref-for-user-invalid-pseudo"},{"id":"ref-for-user-invalid-pseudo\u2460"},{"id":"ref-for-user-invalid-pseudo\u2461"},{"id":"ref-for-user-invalid-pseudo\u2462"}],"title":"13.3.5. \nThe User-interaction Pseudo-classes: :user-valid and :user-invalid"},{"refs":[{"id":"ref-for-user-invalid-pseudo\u2463"}],"title":"20.4. \nChanges since the 2 May 2013 Working Draft"},{"refs":[{"id":"ref-for-user-invalid-pseudo\u2464"}],"title":"20.6. \nChanges since the 29 September 2011 Working Draft"},{"refs":[{"id":"ref-for-user-invalid-pseudo\u2465"}],"title":"20.7. \nChanges Since Level 3"}],"url":"#user-invalid-pseudo"}, "user-valid-pseudo": {"dfnID":"user-valid-pseudo","dfnText":":user-valid","external":false,"refSections":[{"refs":[{"id":"ref-for-user-valid-pseudo"},{"id":"ref-for-user-valid-pseudo\u2460"}],"title":"13.3.5. \nThe User-interaction Pseudo-classes: :user-valid and :user-invalid"},{"refs":[{"id":"ref-for-user-valid-pseudo\u2461"}],"title":"20.2. \nChanges since the 21 November 2018 Working Draft"}],"url":"#user-valid-pseudo"}, "valid-pseudo": {"dfnID":"valid-pseudo","dfnText":":valid","external":false,"refSections":[{"refs":[{"id":"ref-for-valid-pseudo"}],"title":"3.5. \nPseudo-classes"},{"refs":[{"id":"ref-for-valid-pseudo\u2460"},{"id":"ref-for-valid-pseudo\u2461"},{"id":"ref-for-valid-pseudo\u2462"},{"id":"ref-for-valid-pseudo\u2463"}],"title":"13.3.2. \nThe Validity Pseudo-classes: :valid and :invalid"},{"refs":[{"id":"ref-for-valid-pseudo\u2464"}],"title":"13.3.5. \nThe User-interaction Pseudo-classes: :user-valid and :user-invalid"}],"url":"#valid-pseudo"}, "visited-pseudo": {"dfnID":"visited-pseudo","dfnText":":visited","external":false,"refSections":[{"refs":[{"id":"ref-for-visited-pseudo"}],"title":"8.1. \nThe Hyperlink Pseudo-class: :any-link"},{"refs":[{"id":"ref-for-visited-pseudo\u2460"},{"id":"ref-for-visited-pseudo\u2461"}],"title":"8.2. \nThe Link History Pseudo-classes: :link and :visited"},{"refs":[{"id":"ref-for-visited-pseudo\u2462"}],"title":"Privacy Considerations"}],"url":"#visited-pseudo"}, "where-pseudo": {"dfnID":"where-pseudo","dfnText":":where()","external":false,"refSections":[{"refs":[{"id":"ref-for-where-pseudo"},{"id":"ref-for-where-pseudo\u2460"}],"title":"4. \nLogical Combinations"},{"refs":[{"id":"ref-for-where-pseudo\u2461"},{"id":"ref-for-where-pseudo\u2462"},{"id":"ref-for-where-pseudo\u2463"}],"title":"4.4. \nThe Specificity-adjustment Pseudo-class: :where()"},{"refs":[{"id":"ref-for-where-pseudo\u2464"},{"id":"ref-for-where-pseudo\u2465"}],"title":"17. \nCalculating a selector\u2019s specificity"},{"refs":[{"id":"ref-for-where-pseudo\u2466"},{"id":"ref-for-where-pseudo\u2467"},{"id":"ref-for-where-pseudo\u2468"}],"title":"18.1. \n<forgiving-selector-list> and <forgiving-relative-selector-list>"},{"refs":[{"id":"ref-for-where-pseudo\u2460\u24ea"}],"title":"20.2. \nChanges since the 21 November 2018 Working Draft"},{"refs":[{"id":"ref-for-where-pseudo\u2460\u2460"}],"title":"20.3. \nChanges since the 2 February 2018 Working Draft"},{"refs":[{"id":"ref-for-where-pseudo\u2460\u2461"}],"title":"20.7. \nChanges Since Level 3"}],"url":"#where-pseudo"}, "whitespace": {"dfnID":"whitespace","dfnText":"White space","external":false,"refSections":[{"refs":[{"id":"ref-for-whitespace"},{"id":"ref-for-whitespace\u2460"}],"title":"3.5. \nPseudo-classes"},{"refs":[{"id":"ref-for-whitespace\u2461"}],"title":"3.6.1. \nSyntax"},{"refs":[{"id":"ref-for-whitespace"}],"title":"6.1. \nAttribute presence and value selectors"},{"refs":[{"id":"ref-for-whitespace"}],"title":"6.6. \nClass selectors"}],"url":"#whitespace"}, }; document.addEventListener("DOMContentLoaded", ()=>{ genAllDfnPanels(); document.body.addEventListener("click", (e) => { // If not handled already, just hide all dfn panels. hideAllDfnPanels(); }); }); window.addEventListener("resize", () => { // Pin any visible dfn panel queryAll(".dfn-panel.on, .dfn-panel.activated").forEach(el=>positionDfnPanel(el)); }); function genAllDfnPanels() { for(const panelData of Object.values(dfnPanelData)) { const dfnID = panelData.dfnID; const dfn = document.getElementById(dfnID); if(!dfn) { console.log(`Can't find dfn#${dfnID}.`, panelData); continue; } dfn.panelData = panelData; insertDfnPopupAction(dfn); } } function genDfnPanel(dfn, { dfnID, url, dfnText, refSections, external }) { const dfnPanel = mk.aside({ class: "dfn-panel on", id: `infopanel-for-${dfnID}`, "data-for": dfnID, "aria-labelled-by":`infopaneltitle-for-${dfnID}`, }, mk.span({id:`infopaneltitle-for-${dfnID}`, style:"display:none"}, `Info about the '${dfnText}' ${external?"external":""} reference.`), mk.a({href:url, class:"dfn-link"}, url), refSections.length == 0 ? [] : mk.b({}, "Referenced in:"), mk.ul({}, ...refSections.map(section=> mk.li({}, ...section.refs.map((ref, refI)=> [ mk.a({ href: `#${ref.id}` }, (refI == 0) ? section.title : `(${refI + 1})` ), " ", ] ), ), ), ), genLinkingSyntaxes(dfn), ); dfnPanel.addEventListener('click', (event) => { if (event.target.nodeName == 'A') { scrollToTargetAndHighlight(event); pinDfnPanel(dfnPanel); } event.stopPropagation(); refocusOnTarget(event); }); dfnPanel.addEventListener('keydown', (event) => { if(event.keyCode == 27) { // Escape key hideDfnPanel({dfnPanel}); event.stopPropagation(); event.preventDefault(); } }); dfnPanel.dfn = dfn; dfn.dfnPanel = dfnPanel; return dfnPanel; } function hideAllDfnPanels() { // Delete the currently-active dfn panel. queryAll(".dfn-panel").forEach(dfnPanel=>hideDfnPanel({dfnPanel})); } function showDfnPanel(dfn) { hideAllDfnPanels(); // Only display one at a time. dfn.setAttribute("aria-expanded", "true"); const dfnPanel = genDfnPanel(dfn, dfn.panelData); // Give the dfn a unique tabindex, and then // give all the tabbable panel bits successive indexes. let tabIndex = 100; dfn.tabIndex = tabIndex++; const tabbable = dfnPanel.querySelectorAll(":is(a, button)"); for (const el of tabbable) { el.tabIndex = tabIndex++; } append(document.body, dfnPanel); positionDfnPanel(dfnPanel); } function positionDfnPanel(dfnPanel) { const dfn = dfnPanel.dfn; const dfnPos = getBounds(dfn); dfnPanel.style.top = dfnPos.bottom + "px"; dfnPanel.style.left = dfnPos.left + "px"; const panelPos = dfnPanel.getBoundingClientRect(); const panelMargin = 8; const maxRight = document.body.parentNode.clientWidth - panelMargin; if (panelPos.right > maxRight) { const overflowAmount = panelPos.right - maxRight; const newLeft = Math.max(panelMargin, dfnPos.left - overflowAmount); dfnPanel.style.left = newLeft + "px"; } } function pinDfnPanel(dfnPanel) { // Switch it to "activated" state, which pins it. dfnPanel.classList.add("activated"); dfnPanel.style.position = "fixed"; dfnPanel.style.left = null; dfnPanel.style.top = null; } function hideDfnPanel({dfn, dfnPanel}) { if(!dfnPanel) dfnPanel = dfn.dfnPanel; if(!dfn) dfn = dfnPanel.dfn; dfn.dfnPanel = undefined; dfnPanel.dfn = undefined; dfn.setAttribute("aria-expanded", "false"); dfn.tabIndex = undefined; dfnPanel.remove() } function toggleDfnPanel(dfn) { if(dfn.dfnPanel) { hideDfnPanel(dfn); } else { showDfnPanel(dfn); } } function insertDfnPopupAction(dfn) { dfn.setAttribute('role', 'button'); dfn.setAttribute('aria-expanded', 'false') dfn.tabIndex = 0; dfn.classList.add('has-dfn-panel'); dfn.addEventListener('click', (event) => { toggleDfnPanel(dfn); event.stopPropagation(); }); dfn.addEventListener('keypress', (event) => { const kc = event.keyCode; // 32->Space, 13->Enter if(kc == 32 || kc == 13) { toggleDfnPanel(dfn); event.stopPropagation(); event.preventDefault(); } }); } function refocusOnTarget(event) { const target = event.target; setTimeout(() => { // Refocus on the event.target element. // This is needed after browser scrolls to the destination. target.focus(); }); } // TODO: shared util // Returns the root-level absolute position {left and top} of element. function getBounds(el, relativeTo=document.body) { const relativeRect = relativeTo.getBoundingClientRect(); const elRect = el.getBoundingClientRect(); const top = elRect.top - relativeRect.top; const left = elRect.left - relativeRect.left; return { top, left, bottom: top + elRect.height, right: left + elRect.width, } } function scrollToTargetAndHighlight(event) { let hash = event.target.hash; if (hash) { hash = decodeURIComponent(hash.substring(1)); const dest = document.getElementById(hash); if (dest) { dest.classList.add('highlighted'); setTimeout(() => dest.classList.remove('highlighted'), 1000); } } } // Functions, divided by link type, that wrap an autolink's // contents with the appropriate outer syntax. // Alternately, a string naming another type they format // the same as. function needsFor(type) { switch(type) { case "descriptor": case "value": case "element-attr": case "attr-value": case "element-state": case "method": case "constructor": case "argument": case "attribute": case "const": case "dict-member": case "event": case "enum-value": case "stringifier": case "serializer": case "iterator": case "maplike": case "setlike": case "state": case "mode": case "context": case "facet": return true; default: return false; } } function refusesFor(type) { switch(type) { case "property": case "element": case "interface": case "namespace": case "callback": case "dictionary": case "enum": case "exception": case "typedef": case "http-header": case "permission": return true; default: return false; } } function linkFormatterFromType(type) { switch(type) { case 'scheme': case 'permission': case 'dfn': return (text) => `[=${text}=]`; case 'abstract-op': return (text) => `[\$${text}\$]`; case 'function': case 'at-rule': case 'selector': case 'value': return (text) => `''${text}''`; case 'http-header': return (text) => `[:${text}:]`; case 'interface': case 'constructor': case 'method': case 'argument': case 'attribute': case 'callback': case 'dictionary': case 'dict-member': case 'enum': case 'enum-value': case 'exception': case 'const': case 'typedef': case 'stringifier': case 'serializer': case 'iterator': case 'maplike': case 'setlike': case 'extended-attribute': case 'event': case 'idl': return (text) => `{{${text}}}`; case 'element-state': case 'element-attr': case 'attr-value': case 'element': return (element) => `<{${element}}>`; case 'grammar': return (text) => `${text} (within a <pre class=prod>)`; case 'type': return (text)=> `<<${text}>>`; case 'descriptor': case 'property': return (text) => `'${text}'`; default: return; }; }; function genLinkingSyntaxes(dfn) { if(dfn.tagName != "DFN") return; const type = dfn.getAttribute('data-dfn-type'); if(!type) { console.log(`<dfn> doesn't have a data-dfn-type:`, dfn); return []; } // Return a function that wraps link text based on the type const linkFormatter = linkFormatterFromType(type); if(!linkFormatter) { console.log(`<dfn> has an unknown data-dfn-type:`, dfn); return []; } let ltAlts; if(dfn.hasAttribute('data-lt')) { ltAlts = dfn.getAttribute('data-lt') .split("|") .map(x=>x.trim()); } else { ltAlts = [dfn.textContent.trim()]; } if(type == "type") { // lt of "<foo>", but "foo" is the interior; // <<foo/bar>> is how you write it with a for, // not <foo/<bar>> or whatever. for(var i = 0; i < ltAlts.length; i++) { const lt = ltAlts[i]; const match = /<(.*)>/.exec(lt); if(match) { ltAlts[i] = match[1]; } } } let forAlts; if(dfn.hasAttribute('data-dfn-for')) { forAlts = dfn.getAttribute('data-dfn-for') .split(",") .map(x=>x.trim()); } else { forAlts = ['']; } let linkingSyntaxes = []; if(!needsFor(type)) { for(const lt of ltAlts) { linkingSyntaxes.push(linkFormatter(lt)); } } if(!refusesFor(type)) { for(const f of forAlts) { linkingSyntaxes.push(linkFormatter(`${f}/${ltAlts[0]}`)) } } return [ mk.b({}, 'Possible linking syntaxes:'), mk.ul({}, ...linkingSyntaxes.map(link => { const copyLink = async () => await navigator.clipboard.writeText(link); return mk.li({}, mk.div({ class: 'link-item' }, mk.button({ class: 'copy-icon', title: 'Copy', type: 'button', _onclick: copyLink, tabindex: 0, }, mk.span({ class: 'icon' }) ), mk.span({}, link) ) ); }) ) ]; } } </script> <script>/* Boilerplate: script-position-annos */ "use strict"; { function repositionAnnoPanels(){ const panels = [...document.querySelectorAll("[data-anno-for]")]; hydratePanels(panels); let vSoFar = 0; for(const panel of panels.sort(cmpTops)) { if(panel.top < vSoFar) { panel.top = vSoFar; panel.style.top = vSoFar + "px"; } vSoFar = panel.top + panel.height + 15; } } function hydratePanels(panels) { const main = document.querySelector("main"); let mainRect; if(main) mainRect = main.getBoundingClientRect(); // First display them all, if they're not already visible. for(const panel of panels) { panel.classList.remove("unpositioned"); } // Measure them all for(const panel of panels) { const dfn = document.getElementById(panel.getAttribute("data-anno-for")); if(!dfn) { console.log("Can't find the annotation panel target:", panel); continue; } panel.dfn = dfn; panel.top = window.scrollY + dfn.getBoundingClientRect().top; let panelRect = panel.getBoundingClientRect(); panel.height = panelRect.height; if(main) { panel.overlappingMain = panelRect.left < mainRect.right; } else { panel.overlappingMain = false; } } // And finally position them for(const panel of panels) { const dfn = panel.dfn; if(!dfn) continue; panel.style.top = panel.top + "px"; panel.classList.toggle("overlapping-main", panel.overlappingMain); } } function cmpTops(a,b) { return a.top - b.top; } window.addEventListener("load", repositionAnnoPanels); window.addEventListener("resize", repositionAnnoPanels); } </script> <script>/* Boilerplate: script-ref-hints */ "use strict"; { let refsData = { "#active-pseudo": {"displayText":":active","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":active","type":"selector","url":"#active-pseudo"}, "#any-link-pseudo": {"displayText":":any-link","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":any-link","type":"selector","url":"#any-link-pseudo"}, "#attribute-selector": {"displayText":"attribute selector","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"attribute selector","type":"dfn","url":"#attribute-selector"}, "#blank-pseudo": {"displayText":":blank","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":blank","type":"selector","url":"#blank-pseudo"}, "#checked-pseudo": {"displayText":":checked","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":checked","type":"selector","url":"#checked-pseudo"}, "#child-combinator": {"displayText":"child combinator","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"child combinator","type":"dfn","url":"#child-combinator"}, "#class-selector": {"displayText":"class selector","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"class selector","type":"dfn","url":"#class-selector"}, "#column-combinator": {"displayText":"column combinator","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"column combinator","type":"dfn","url":"#column-combinator"}, "#complex": {"displayText":"complex selector","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"complex selector","type":"dfn","url":"#complex"}, "#compound": {"displayText":"compound selector","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"compound selector","type":"dfn","url":"#compound"}, "#current-pseudo": {"displayText":":current","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":current","type":"selector","url":"#current-pseudo"}, "#default-pseudo": {"displayText":":default","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":default","type":"selector","url":"#default-pseudo"}, "#defined-pseudo": {"displayText":":defined","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":defined","type":"selector","url":"#defined-pseudo"}, "#descendant-combinator": {"displayText":"descendant combinator","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"descendant combinator","type":"dfn","url":"#descendant-combinator"}, "#dir-pseudo": {"displayText":":dir()","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":dir()","type":"selector","url":"#dir-pseudo"}, "#disabled-pseudo": {"displayText":":disabled","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":disabled","type":"selector","url":"#disabled-pseudo"}, "#document-language": {"displayText":"document language","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"document language","type":"dfn","url":"#document-language"}, "#empty-pseudo": {"displayText":":empty","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":empty","type":"selector","url":"#empty-pseudo"}, "#enabled-pseudo": {"displayText":":enabled","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":enabled","type":"selector","url":"#enabled-pseudo"}, "#featureless": {"displayText":"featureless","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"featureless","type":"dfn","url":"#featureless"}, "#first-child-pseudo": {"displayText":":first-child","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":first-child","type":"selector","url":"#first-child-pseudo"}, "#first-of-type-pseudo": {"displayText":":first-of-type","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":first-of-type","type":"selector","url":"#first-of-type-pseudo"}, "#focus-pseudo": {"displayText":":focus","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":focus","type":"selector","url":"#focus-pseudo"}, "#focus-visible-pseudo": {"displayText":":focus-visible","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":focus-visible","type":"selector","url":"#focus-visible-pseudo"}, "#focus-within-pseudo": {"displayText":":focus-within","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":focus-within","type":"selector","url":"#focus-within-pseudo"}, "#functional-pseudo-class": {"displayText":"functional pseudo-class","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"functional pseudo-class","type":"dfn","url":"#functional-pseudo-class"}, "#future-pseudo": {"displayText":":future","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":future","type":"selector","url":"#future-pseudo"}, "#has-allowed-pseudo-element": {"displayText":":has-allowed pseudo-element","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":has-allowed pseudo-element","type":"dfn","url":"#has-allowed-pseudo-element"}, "#has-pseudo": {"displayText":":has()","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":has()","type":"selector","url":"#has-pseudo"}, "#host-language": {"displayText":"host language","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"host language","type":"dfn","url":"#host-language"}, "#hover-pseudo": {"displayText":":hover","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":hover","type":"selector","url":"#hover-pseudo"}, "#id-selector": {"displayText":"id selector","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"id selector","type":"dfn","url":"#id-selector"}, "#in-range-pseudo": {"displayText":":in-range","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":in-range","type":"selector","url":"#in-range-pseudo"}, "#indeterminate-pseudo": {"displayText":":indeterminate","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":indeterminate","type":"selector","url":"#indeterminate-pseudo"}, "#indicate-focus": {"displayText":"indicate focus","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"indicate focus","type":"dfn","url":"#indicate-focus"}, "#invalid-pseudo": {"displayText":":invalid","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":invalid","type":"selector","url":"#invalid-pseudo"}, "#invalid-selector": {"displayText":"invalid selector","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"invalid selector","type":"dfn","url":"#invalid-selector"}, "#lang-pseudo": {"displayText":":lang()","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":lang()","type":"selector","url":"#lang-pseudo"}, "#language-range": {"displayText":"language range","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"language range","type":"dfn","url":"#language-range"}, "#last-child-pseudo": {"displayText":":last-child","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":last-child","type":"selector","url":"#last-child-pseudo"}, "#last-of-type-pseudo": {"displayText":":last-of-type","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":last-of-type","type":"selector","url":"#last-of-type-pseudo"}, "#legacy-selector-alias": {"displayText":"legacy selector alias","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"legacy selector alias","type":"dfn","url":"#legacy-selector-alias"}, "#link-pseudo": {"displayText":":link","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":link","type":"selector","url":"#link-pseudo"}, "#list-of-simple-selectors": {"displayText":"list of complex selectors","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"list of complex selectors","type":"dfn","url":"#list-of-simple-selectors"}, "#local-link-pseudo": {"displayText":":local-link","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":local-link","type":"selector","url":"#local-link-pseudo"}, "#logical-combination-pseudo-classes": {"displayText":"logical combination pseudo-classes","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"logical combination pseudo-classes","type":"dfn","url":"#logical-combination-pseudo-classes"}, "#match": {"displayText":"match","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"match","type":"dfn","url":"#match"}, "#match-a-complex-selector-against-an-element": {"displayText":"match a complex selector against an element","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"match a complex selector against an element","type":"dfn","url":"#match-a-complex-selector-against-an-element"}, "#match-a-selector-against-a-pseudo-element": {"displayText":"match a selector against a pseudo-element","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"match a selector against a pseudo-element","type":"dfn","url":"#match-a-selector-against-a-pseudo-element"}, "#match-a-selector-against-a-tree": {"displayText":"match a selector against a tree","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"match a selector against a tree","type":"dfn","url":"#match-a-selector-against-a-tree"}, "#match-a-selector-against-an-element": {"displayText":"match a selector against an element","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"match a selector against an element","type":"dfn","url":"#match-a-selector-against-an-element"}, "#matches-pseudo": {"displayText":":is()","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":is()","type":"selector","url":"#matches-pseudo"}, "#negation-pseudo": {"displayText":":not()","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":not()","type":"selector","url":"#negation-pseudo"}, "#next-sibling-combinator": {"displayText":"next-sibling combinator","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"next-sibling combinator","type":"dfn","url":"#next-sibling-combinator"}, "#nsdecl": {"displayText":"declared","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"declared","type":"dfn","url":"#nsdecl"}, "#nth-child-pseudo": {"displayText":":nth-child()","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":nth-child()","type":"selector","url":"#nth-child-pseudo"}, "#nth-col-pseudo": {"displayText":":nth-col()","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":nth-col()","type":"selector","url":"#nth-col-pseudo"}, "#nth-last-child-pseudo": {"displayText":":nth-last-child()","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":nth-last-child()","type":"selector","url":"#nth-last-child-pseudo"}, "#nth-last-col-pseudo": {"displayText":":nth-last-col()","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":nth-last-col()","type":"selector","url":"#nth-last-col-pseudo"}, "#nth-last-of-type-pseudo": {"displayText":":nth-last-of-type()","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":nth-last-of-type()","type":"selector","url":"#nth-last-of-type-pseudo"}, "#nth-of-type-pseudo": {"displayText":":nth-of-type()","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":nth-of-type()","type":"selector","url":"#nth-of-type-pseudo"}, "#only-child-pseudo": {"displayText":":only-child","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":only-child","type":"selector","url":"#only-child-pseudo"}, "#only-of-type-pseudo": {"displayText":":only-of-type","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":only-of-type","type":"selector","url":"#only-of-type-pseudo"}, "#optional-pseudo": {"displayText":":optional","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":optional","type":"selector","url":"#optional-pseudo"}, "#originating-element": {"displayText":"originating element","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"originating element","type":"dfn","url":"#originating-element"}, "#originating-pseudo-element": {"displayText":"originating pseudo-element","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"originating pseudo-element","type":"dfn","url":"#originating-pseudo-element"}, "#out-of-range-pseudo": {"displayText":":out-of-range","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":out-of-range","type":"selector","url":"#out-of-range-pseudo"}, "#parse-as-a-forgiving-selector-list": {"displayText":"parse as a forgiving selector list","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"parse as a forgiving selector list","type":"dfn","url":"#parse-as-a-forgiving-selector-list"}, "#past-pseudo": {"displayText":":past","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":past","type":"selector","url":"#past-pseudo"}, "#placeholder-shown-pseudo": {"displayText":":placeholder-shown","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":placeholder-shown","type":"selector","url":"#placeholder-shown-pseudo"}, "#pseudo-class": {"displayText":"pseudo-class","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"pseudo-class","type":"dfn","url":"#pseudo-class"}, "#pseudo-compound": {"displayText":"pseudo-compound selector","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"pseudo-compound selector","type":"dfn","url":"#pseudo-compound"}, "#pseudo-element": {"displayText":"pseudo-element","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"pseudo-element","type":"dfn","url":"#pseudo-element"}, "#read-only-pseudo": {"displayText":":read-only","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":read-only","type":"selector","url":"#read-only-pseudo"}, "#read-write-pseudo": {"displayText":":read-write","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":read-write","type":"selector","url":"#read-write-pseudo"}, "#relative-selector": {"displayText":"relative selector","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"relative selector","type":"dfn","url":"#relative-selector"}, "#relative-selector-anchor-elements": {"displayText":"anchor element","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"anchor element","type":"dfn","url":"#relative-selector-anchor-elements"}, "#required-pseudo": {"displayText":":required","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":required","type":"selector","url":"#required-pseudo"}, "#root-pseudo": {"displayText":":root","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":root","type":"selector","url":"#root-pseudo"}, "#scope-pseudo": {"displayText":":scope","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":scope","type":"selector","url":"#scope-pseudo"}, "#scoped-selector": {"displayText":"scope","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"scope","type":"dfn","url":"#scoped-selector"}, "#scoping-root": {"displayText":"scoping root","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"scoping root","type":"dfn","url":"#scoping-root"}, "#selector": {"displayText":"selector","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"selector","type":"dfn","url":"#selector"}, "#selector-combinator": {"displayText":"combinator","export":true,"for_":["selector"],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"combinator","type":"dfn","url":"#selector-combinator"}, "#selector-list": {"displayText":"selector list","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"selector list","type":"dfn","url":"#selector-list"}, "#selector-subject": {"displayText":"subject","export":true,"for_":["selector"],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"subject","type":"dfn","url":"#selector-subject"}, "#selectordef-autofill": {"displayText":":autofill","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":autofill","type":"selector","url":"#selectordef-autofill"}, "#selectordef-buffering": {"displayText":":buffering","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":buffering","type":"selector","url":"#selectordef-buffering"}, "#selectordef-child": {"displayText":">","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":">","type":"selector","url":"#selectordef-child"}, "#selectordef-closed": {"displayText":":closed","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":closed","type":"selector","url":"#selectordef-closed"}, "#selectordef-fullscreen": {"displayText":":fullscreen","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":fullscreen","type":"selector","url":"#selectordef-fullscreen"}, "#selectordef-matches": {"displayText":":matches()","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":matches()","type":"selector","url":"#selectordef-matches"}, "#selectordef-modal": {"displayText":":modal","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":modal","type":"selector","url":"#selectordef-modal"}, "#selectordef-muted": {"displayText":":muted","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":muted","type":"selector","url":"#selectordef-muted"}, "#selectordef-open": {"displayText":":open","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":open","type":"selector","url":"#selectordef-open"}, "#selectordef-paused": {"displayText":":paused","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":paused","type":"selector","url":"#selectordef-paused"}, "#selectordef-picture-in-picture": {"displayText":":picture-in-picture","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":picture-in-picture","type":"selector","url":"#selectordef-picture-in-picture"}, "#selectordef-playing": {"displayText":":playing","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":playing","type":"selector","url":"#selectordef-playing"}, "#selectordef-seeking": {"displayText":":seeking","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":seeking","type":"selector","url":"#selectordef-seeking"}, "#selectordef-stalled": {"displayText":":stalled","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":stalled","type":"selector","url":"#selectordef-stalled"}, "#selectordef-volume-locked": {"displayText":":volume-locked","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":volume-locked","type":"selector","url":"#selectordef-volume-locked"}, "#simple": {"displayText":"simple selector","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"simple selector","type":"dfn","url":"#simple"}, "#specificity": {"displayText":"specificity","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"specificity","type":"dfn","url":"#specificity"}, "#structural-pseudo-classes": {"displayText":"structural pseudo-classes","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"structural pseudo-classes","type":"dfn","url":"#structural-pseudo-classes"}, "#sub-pseudo-element": {"displayText":"sub-pseudo-element","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"sub-pseudo-element","type":"dfn","url":"#sub-pseudo-element"}, "#subsequent-sibling-combinator": {"displayText":"subsequent-sibling combinator","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"subsequent-sibling combinator","type":"dfn","url":"#subsequent-sibling-combinator"}, "#target-pseudo": {"displayText":":target","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":target","type":"selector","url":"#target-pseudo"}, "#target-within-pseudo": {"displayText":":target-within","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":target-within","type":"selector","url":"#target-within-pseudo"}, "#type-selector": {"displayText":"type selector","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"type selector","type":"dfn","url":"#type-selector"}, "#typedef-attr-matcher": {"displayText":"<attr-matcher>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<attr-matcher>","type":"type","url":"#typedef-attr-matcher"}, "#typedef-attr-modifier": {"displayText":"<attr-modifier>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<attr-modifier>","type":"type","url":"#typedef-attr-modifier"}, "#typedef-attribute-selector": {"displayText":"<attribute-selector>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<attribute-selector>","type":"type","url":"#typedef-attribute-selector"}, "#typedef-class-selector": {"displayText":"<class-selector>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<class-selector>","type":"type","url":"#typedef-class-selector"}, "#typedef-combinator": {"displayText":"<combinator>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<combinator>","type":"type","url":"#typedef-combinator"}, "#typedef-complex-real-selector": {"displayText":"<complex-real-selector>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<complex-real-selector>","type":"type","url":"#typedef-complex-real-selector"}, "#typedef-complex-real-selector-list": {"displayText":"<complex-real-selector-list>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<complex-real-selector-list>","type":"type","url":"#typedef-complex-real-selector-list"}, "#typedef-complex-selector": {"displayText":"<complex-selector>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<complex-selector>","type":"type","url":"#typedef-complex-selector"}, "#typedef-complex-selector-list": {"displayText":"<complex-selector-list>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<complex-selector-list>","type":"type","url":"#typedef-complex-selector-list"}, "#typedef-complex-selector-unit": {"displayText":"<complex-selector-unit>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<complex-selector-unit>","type":"type","url":"#typedef-complex-selector-unit"}, "#typedef-compound-selector": {"displayText":"<compound-selector>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<compound-selector>","type":"type","url":"#typedef-compound-selector"}, "#typedef-forgiving-selector-list": {"displayText":"<forgiving-selector-list>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<forgiving-selector-list>","type":"type","url":"#typedef-forgiving-selector-list"}, "#typedef-id-selector": {"displayText":"<id-selector>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<id-selector>","type":"type","url":"#typedef-id-selector"}, "#typedef-legacy-pseudo-element-selector": {"displayText":"<legacy-pseudo-element-selector>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<legacy-pseudo-element-selector>","type":"type","url":"#typedef-legacy-pseudo-element-selector"}, "#typedef-ns-prefix": {"displayText":"<ns-prefix>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<ns-prefix>","type":"type","url":"#typedef-ns-prefix"}, "#typedef-pseudo-class-selector": {"displayText":"<pseudo-class-selector>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<pseudo-class-selector>","type":"type","url":"#typedef-pseudo-class-selector"}, "#typedef-pseudo-compound-selector": {"displayText":"<pseudo-compound-selector>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<pseudo-compound-selector>","type":"type","url":"#typedef-pseudo-compound-selector"}, "#typedef-pseudo-element-selector": {"displayText":"<pseudo-element-selector>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<pseudo-element-selector>","type":"type","url":"#typedef-pseudo-element-selector"}, "#typedef-relative-real-selector": {"displayText":"<relative-real-selector>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<relative-real-selector>","type":"type","url":"#typedef-relative-real-selector"}, "#typedef-relative-selector": {"displayText":"<relative-selector>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<relative-selector>","type":"type","url":"#typedef-relative-selector"}, "#typedef-relative-selector-list": {"displayText":"<relative-selector-list>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<relative-selector-list>","type":"type","url":"#typedef-relative-selector-list"}, "#typedef-selector-list": {"displayText":"<selector-list>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<selector-list>","type":"type","url":"#typedef-selector-list"}, "#typedef-simple-selector": {"displayText":"<simple-selector>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<simple-selector>","type":"type","url":"#typedef-simple-selector"}, "#typedef-subclass-selector": {"displayText":"<subclass-selector>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<subclass-selector>","type":"type","url":"#typedef-subclass-selector"}, "#typedef-type-selector": {"displayText":"<type-selector>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<type-selector>","type":"type","url":"#typedef-type-selector"}, "#typedef-wq-name": {"displayText":"<wq-name>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"<wq-name>","type":"type","url":"#typedef-wq-name"}, "#universal-selector": {"displayText":"universal selector","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"universal selector","type":"dfn","url":"#universal-selector"}, "#unknown--webkit--pseudo-elements": {"displayText":"unknown -webkit- pseudo-elements","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"unknown -webkit- pseudo-elements","type":"dfn","url":"#unknown--webkit--pseudo-elements"}, "#user-action-pseudo-class": {"displayText":"user action pseudo-class","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"user action pseudo-class","type":"dfn","url":"#user-action-pseudo-class"}, "#user-invalid-pseudo": {"displayText":":user-invalid","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":user-invalid","type":"selector","url":"#user-invalid-pseudo"}, "#user-valid-pseudo": {"displayText":":user-valid","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":user-valid","type":"selector","url":"#user-valid-pseudo"}, "#valid-pseudo": {"displayText":":valid","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":valid","type":"selector","url":"#valid-pseudo"}, "#visited-pseudo": {"displayText":":visited","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":visited","type":"selector","url":"#visited-pseudo"}, "#where-pseudo": {"displayText":":where()","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":":where()","type":"selector","url":"#where-pseudo"}, "#whitespace": {"displayText":"white space","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"local","text":"white space","type":"dfn","url":"#whitespace"}, "https://dom.spec.whatwg.org/#concept-document-quirks": {"displayText":"quirks mode","export":true,"for_":[],"level":"1","normative":true,"shortname":"dom","spec":"dom","status":"current","text":"quirks mode","type":"dfn","url":"https://dom.spec.whatwg.org/#concept-document-quirks"}, "https://dom.spec.whatwg.org/#concept-shadow-including-tree-order": {"displayText":"shadow-including tree order","export":true,"for_":[],"level":"1","normative":true,"shortname":"dom","spec":"dom","status":"current","text":"shadow-including tree order","type":"dfn","url":"https://dom.spec.whatwg.org/#concept-shadow-including-tree-order"}, "https://dom.spec.whatwg.org/#concept-shadow-tree": {"displayText":"shadow tree","export":true,"for_":[],"level":"1","normative":true,"shortname":"dom","spec":"dom","status":"current","text":"shadow tree","type":"dfn","url":"https://dom.spec.whatwg.org/#concept-shadow-tree"}, "https://dom.spec.whatwg.org/#concept-tree": {"displayText":"tree","export":true,"for_":[],"level":"1","normative":true,"shortname":"dom","spec":"dom","status":"current","text":"tree","type":"dfn","url":"https://dom.spec.whatwg.org/#concept-tree"}, "https://dom.spec.whatwg.org/#concept-tree-descendant": {"displayText":"descendant","export":true,"for_":["tree"],"level":"1","normative":true,"shortname":"dom","spec":"dom","status":"current","text":"descendant","type":"dfn","url":"https://dom.spec.whatwg.org/#concept-tree-descendant"}, "https://dom.spec.whatwg.org/#concept-tree-inclusive-sibling": {"displayText":"inclusive sibling","export":true,"for_":["tree"],"level":"1","normative":true,"shortname":"dom","spec":"dom","status":"current","text":"inclusive sibling","type":"dfn","url":"https://dom.spec.whatwg.org/#concept-tree-inclusive-sibling"}, "https://dom.spec.whatwg.org/#concept-tree-root": {"displayText":"root","export":true,"for_":["tree"],"level":"1","normative":true,"shortname":"dom","spec":"dom","status":"current","text":"root","type":"dfn","url":"https://dom.spec.whatwg.org/#concept-tree-root"}, "https://dom.spec.whatwg.org/#document-element": {"displayText":"document element","export":true,"for_":[],"level":"1","normative":true,"shortname":"dom","spec":"dom","status":"current","text":"document element","type":"dfn","url":"https://dom.spec.whatwg.org/#document-element"}, "https://dom.spec.whatwg.org/#documentfragment": {"displayText":"DocumentFragment","export":true,"for_":[],"level":"1","normative":true,"shortname":"dom","spec":"dom","status":"current","text":"DocumentFragment","type":"interface","url":"https://dom.spec.whatwg.org/#documentfragment"}, "https://dom.spec.whatwg.org/#dom-node-parentnode": {"displayText":"parentNode","export":true,"for_":["Node"],"level":"1","normative":true,"shortname":"dom","spec":"dom","status":"current","text":"parentNode","type":"attribute","url":"https://dom.spec.whatwg.org/#dom-node-parentnode"}, "https://dom.spec.whatwg.org/#element-shadow-host": {"displayText":"shadow host","export":true,"for_":["Element"],"level":"1","normative":true,"shortname":"dom","spec":"dom","status":"current","text":"shadow host","type":"dfn","url":"https://dom.spec.whatwg.org/#element-shadow-host"}, "https://drafts.csswg.org/css-color-5/#valdef-lab-a": {"displayText":"a","export":true,"for_":["lab()"],"level":"5","normative":true,"shortname":"css-color","spec":"css-color-5","status":"current","text":"a","type":"value","url":"https://drafts.csswg.org/css-color-5/#valdef-lab-a"}, "https://drafts.csswg.org/css-display-3/#propdef-display": {"displayText":"display","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-display","spec":"css-display-3","status":"current","text":"display","type":"property","url":"https://drafts.csswg.org/css-display-3/#propdef-display"}, "https://drafts.csswg.org/css-display-4/#box-tree": {"displayText":"box tree","export":true,"for_":["CSS"],"level":"4","normative":true,"shortname":"css-display","spec":"css-display-4","status":"current","text":"box tree","type":"dfn","url":"https://drafts.csswg.org/css-display-4/#box-tree"}, "https://drafts.csswg.org/css-display-4/#display-type": {"displayText":"display type","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-display","spec":"css-display-4","status":"current","text":"display type","type":"dfn","url":"https://drafts.csswg.org/css-display-4/#display-type"}, "https://drafts.csswg.org/css-display-4/#propdef-visibility": {"displayText":"visibility","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-display","spec":"css-display-4","status":"current","text":"visibility","type":"property","url":"https://drafts.csswg.org/css-display-4/#propdef-visibility"}, "https://drafts.csswg.org/css-display-4/#valdef-display-list-item": {"displayText":"list-item","export":true,"for_":["display","<display-list-item>"],"level":"4","normative":true,"shortname":"css-display","spec":"css-display-4","status":"current","text":"list-item","type":"value","url":"https://drafts.csswg.org/css-display-4/#valdef-display-list-item"}, "https://drafts.csswg.org/css-multicol-2/#selectordef-column": {"displayText":"::column","export":true,"for_":[],"level":"2","normative":true,"shortname":"css-multicol","spec":"css-multicol-2","status":"current","text":"::column","type":"selector","url":"https://drafts.csswg.org/css-multicol-2/#selectordef-column"}, "https://drafts.csswg.org/css-namespaces-3/#at-ruledef-namespace": {"displayText":"@namespace","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-namespaces","spec":"css-namespaces-3","status":"current","text":"@namespace","type":"at-rule","url":"https://drafts.csswg.org/css-namespaces-3/#at-ruledef-namespace"}, "https://drafts.csswg.org/css-namespaces-3/#css-qualified-name": {"displayText":"CSS qualified name","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-namespaces","spec":"css-namespaces-3","status":"current","text":"css qualified name","type":"dfn","url":"https://drafts.csswg.org/css-namespaces-3/#css-qualified-name"}, "https://drafts.csswg.org/css-namespaces-3/#default-namespace": {"displayText":"default namespace","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-namespaces","spec":"css-namespaces-3","status":"current","text":"default namespace","type":"dfn","url":"https://drafts.csswg.org/css-namespaces-3/#default-namespace"}, "https://drafts.csswg.org/css-pseudo-4/#selectordef-after": {"displayText":"::after","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-pseudo","spec":"css-pseudo-4","status":"current","text":"::after","type":"selector","url":"https://drafts.csswg.org/css-pseudo-4/#selectordef-after"}, "https://drafts.csswg.org/css-pseudo-4/#selectordef-before": {"displayText":"::before","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-pseudo","spec":"css-pseudo-4","status":"current","text":"::before","type":"selector","url":"https://drafts.csswg.org/css-pseudo-4/#selectordef-before"}, "https://drafts.csswg.org/css-pseudo-4/#selectordef-first-letter": {"displayText":"::first-letter","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-pseudo","spec":"css-pseudo-4","status":"current","text":"::first-letter","type":"selector","url":"https://drafts.csswg.org/css-pseudo-4/#selectordef-first-letter"}, "https://drafts.csswg.org/css-pseudo-4/#selectordef-first-line": {"displayText":"::first-line","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-pseudo","spec":"css-pseudo-4","status":"current","text":"::first-line","type":"selector","url":"https://drafts.csswg.org/css-pseudo-4/#selectordef-first-line"}, "https://drafts.csswg.org/css-pseudo-4/#selectordef-marker": {"displayText":"::marker","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-pseudo","spec":"css-pseudo-4","status":"current","text":"::marker","type":"selector","url":"https://drafts.csswg.org/css-pseudo-4/#selectordef-marker"}, "https://drafts.csswg.org/css-pseudo-4/#tree-abiding": {"displayText":"tree-abiding pseudo-elements","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-pseudo","spec":"css-pseudo-4","status":"current","text":"tree-abiding pseudo-elements","type":"dfn","url":"https://drafts.csswg.org/css-pseudo-4/#tree-abiding"}, "https://drafts.csswg.org/css-scoping-1/#flat-tree": {"displayText":"flat tree","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-scoping","spec":"css-scoping-1","status":"current","text":"flat tree","type":"dfn","url":"https://drafts.csswg.org/css-scoping-1/#flat-tree"}, "https://drafts.csswg.org/css-scoping-1/#selectordef-host": {"displayText":":host","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-scoping","spec":"css-scoping-1","status":"current","text":":host","type":"selector","url":"https://drafts.csswg.org/css-scoping-1/#selectordef-host"}, "https://drafts.csswg.org/css-scoping-1/#selectordef-host-context": {"displayText":":host-context()","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-scoping","spec":"css-scoping-1","status":"current","text":":host-context()","type":"selector","url":"https://drafts.csswg.org/css-scoping-1/#selectordef-host-context"}, "https://drafts.csswg.org/css-scoping-1/#selectordef-slotted": {"displayText":"::slotted()","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-scoping","spec":"css-scoping-1","status":"current","text":"::slotted()","type":"selector","url":"https://drafts.csswg.org/css-scoping-1/#selectordef-slotted"}, "https://drafts.csswg.org/css-syntax-3/#anb-production": {"displayText":"<an+b>","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-syntax","spec":"css-syntax-3","status":"current","text":"<an+b>","type":"type","url":"https://drafts.csswg.org/css-syntax-3/#anb-production"}, "https://drafts.csswg.org/css-syntax-3/#css-parse-a-comma-separated-list-according-to-a-css-grammar": {"displayText":"parse a list","export":true,"for_":["CSS"],"level":"3","normative":true,"shortname":"css-syntax","spec":"css-syntax-3","status":"current","text":"parse a list","type":"dfn","url":"https://drafts.csswg.org/css-syntax-3/#css-parse-a-comma-separated-list-according-to-a-css-grammar"}, "https://drafts.csswg.org/css-syntax-3/#css-parse-something-according-to-a-css-grammar": {"displayText":"parse","export":true,"for_":["CSS"],"level":"3","normative":true,"shortname":"css-syntax","spec":"css-syntax-3","status":"current","text":"parse","type":"dfn","url":"https://drafts.csswg.org/css-syntax-3/#css-parse-something-according-to-a-css-grammar"}, "https://drafts.csswg.org/css-syntax-3/#typedef-any-value": {"displayText":"<any-value>","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-syntax","spec":"css-syntax-3","status":"current","text":"<any-value>","type":"type","url":"https://drafts.csswg.org/css-syntax-3/#typedef-any-value"}, "https://drafts.csswg.org/css-syntax-3/#typedef-function-token": {"displayText":"<function-token>","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-syntax","spec":"css-syntax-3","status":"current","text":"<function-token>","type":"type","url":"https://drafts.csswg.org/css-syntax-3/#typedef-function-token"}, "https://drafts.csswg.org/css-syntax-3/#typedef-hash-token": {"displayText":"<hash-token>","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-syntax","spec":"css-syntax-3","status":"current","text":"<hash-token>","type":"type","url":"https://drafts.csswg.org/css-syntax-3/#typedef-hash-token"}, "https://drafts.csswg.org/css-syntax-3/#typedef-ident-token": {"displayText":"<ident-token>","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-syntax","spec":"css-syntax-3","status":"current","text":"<ident-token>","type":"type","url":"https://drafts.csswg.org/css-syntax-3/#typedef-ident-token"}, "https://drafts.csswg.org/css-syntax-3/#typedef-string-token": {"displayText":"<string-token>","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-syntax","spec":"css-syntax-3","status":"current","text":"<string-token>","type":"type","url":"https://drafts.csswg.org/css-syntax-3/#typedef-string-token"}, "https://drafts.csswg.org/css-text-4/#content-language": {"displayText":"content language","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-text","spec":"css-text-4","status":"current","text":"content language","type":"dfn","url":"https://drafts.csswg.org/css-text-4/#content-language"}, "https://drafts.csswg.org/css-text-4/#white-space": {"displayText":"document white space characters","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-text","spec":"css-text-4","status":"current","text":"document white space characters","type":"dfn","url":"https://drafts.csswg.org/css-text-4/#white-space"}, "https://drafts.csswg.org/css-values-4/#comb-one": {"displayText":"|","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"current","text":"|","type":"grammar","url":"https://drafts.csswg.org/css-values-4/#comb-one"}, "https://drafts.csswg.org/css-values-4/#css-css-identifier": {"displayText":"identifier","export":true,"for_":["CSS"],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"current","text":"identifier","type":"dfn","url":"https://drafts.csswg.org/css-values-4/#css-css-identifier"}, "https://drafts.csswg.org/css-values-4/#mult-comma": {"displayText":"#","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"current","text":"#","type":"grammar","url":"https://drafts.csswg.org/css-values-4/#mult-comma"}, "https://drafts.csswg.org/css-values-4/#mult-opt": {"displayText":"?","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"current","text":"?","type":"grammar","url":"https://drafts.csswg.org/css-values-4/#mult-opt"}, "https://drafts.csswg.org/css-values-4/#mult-req": {"displayText":"!","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"current","text":"!","type":"grammar","url":"https://drafts.csswg.org/css-values-4/#mult-req"}, "https://drafts.csswg.org/css-values-4/#mult-zero-plus": {"displayText":"*","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"current","text":"*","type":"grammar","url":"https://drafts.csswg.org/css-values-4/#mult-zero-plus"}, "https://drafts.csswg.org/css-values-4/#string-value": {"displayText":"<string>","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"current","text":"<string>","type":"type","url":"https://drafts.csswg.org/css-values-4/#string-value"}, "https://drafts.csswg.org/css-values-4/#typedef-ident": {"displayText":"<ident>","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"current","text":"<ident>","type":"type","url":"https://drafts.csswg.org/css-values-4/#typedef-ident"}, "https://drafts.csswg.org/css-writing-modes-3/#propdef-direction": {"displayText":"direction","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-writing-modes","spec":"css-writing-modes-3","status":"current","text":"direction","type":"property","url":"https://drafts.csswg.org/css-writing-modes-3/#propdef-direction"}, "https://drafts.csswg.org/css2/#selectordef-before": {"displayText":":before","export":true,"for_":[],"level":"1","normative":true,"shortname":"css","spec":"css22","status":"current","text":":before","type":"selector","url":"https://drafts.csswg.org/css2/#selectordef-before"}, "https://drafts.csswg.org/selectors-3/#x": {"displayText":"*","export":true,"for_":[],"level":"3","normative":true,"shortname":"selectors","spec":"selectors-3","status":"current","text":"*","type":"selector","url":"https://drafts.csswg.org/selectors-3/#x"}, "https://fullscreen.spec.whatwg.org/#dom-element-requestfullscreen": {"displayText":"requestFullscreen()","export":true,"for_":["Element"],"level":"1","normative":true,"shortname":"fullscreen","spec":"fullscreen","status":"current","text":"requestFullscreen()","type":"method","url":"https://fullscreen.spec.whatwg.org/#dom-element-requestfullscreen"}, "https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element": {"displayText":"custom element","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"custom element","type":"dfn","url":"https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element"}, "https://html.spec.whatwg.org/multipage/custom-elements.html#element-definition": {"displayText":"element definition","export":false,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"element definition","type":"dfn","url":"https://html.spec.whatwg.org/multipage/custom-elements.html#element-definition"}, "https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element": {"displayText":"img","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"img","type":"element","url":"https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element"}, "https://html.spec.whatwg.org/multipage/form-elements.html#the-button-element": {"displayText":"button","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"button","type":"element","url":"https://html.spec.whatwg.org/multipage/form-elements.html#the-button-element"}, "https://html.spec.whatwg.org/multipage/form-elements.html#the-select-element": {"displayText":"select","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"select","type":"element","url":"https://html.spec.whatwg.org/multipage/form-elements.html#the-select-element"}, "https://html.spec.whatwg.org/multipage/form-elements.html#the-textarea-element": {"displayText":"textarea","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"textarea","type":"element","url":"https://html.spec.whatwg.org/multipage/form-elements.html#the-textarea-element"}, "https://html.spec.whatwg.org/multipage/forms.html#the-label-element": {"displayText":"label","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"label","type":"element","url":"https://html.spec.whatwg.org/multipage/forms.html#the-label-element"}, "https://html.spec.whatwg.org/multipage/grouping-content.html#the-div-element": {"displayText":"div","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"div","type":"element","url":"https://html.spec.whatwg.org/multipage/grouping-content.html#the-div-element"}, "https://html.spec.whatwg.org/multipage/grouping-content.html#the-li-element": {"displayText":"li","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"li","type":"element","url":"https://html.spec.whatwg.org/multipage/grouping-content.html#the-li-element"}, "https://html.spec.whatwg.org/multipage/grouping-content.html#the-ol-element": {"displayText":"ol","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"ol","type":"element","url":"https://html.spec.whatwg.org/multipage/grouping-content.html#the-ol-element"}, "https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element": {"displayText":"p","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"p","type":"element","url":"https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element"}, "https://html.spec.whatwg.org/multipage/grouping-content.html#the-pre-element": {"displayText":"pre","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"pre","type":"element","url":"https://html.spec.whatwg.org/multipage/grouping-content.html#the-pre-element"}, "https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-object-element": {"displayText":"object","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"object","type":"element","url":"https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-object-element"}, "https://html.spec.whatwg.org/multipage/image-maps.html#the-area-element": {"displayText":"area","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"area","type":"element","url":"https://html.spec.whatwg.org/multipage/image-maps.html#the-area-element"}, "https://html.spec.whatwg.org/multipage/input.html#attr-input-placeholder": {"displayText":"placeholder","export":true,"for_":["input"],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"placeholder","type":"element-attr","url":"https://html.spec.whatwg.org/multipage/input.html#attr-input-placeholder"}, "https://html.spec.whatwg.org/multipage/input.html#the-input-element": {"displayText":"input","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"input","type":"element","url":"https://html.spec.whatwg.org/multipage/input.html#the-input-element"}, "https://html.spec.whatwg.org/multipage/interactive-elements.html#dom-dialog-showmodal": {"displayText":"showModal()","export":true,"for_":["HTMLDialogElement"],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"showModal()","type":"method","url":"https://html.spec.whatwg.org/multipage/interactive-elements.html#dom-dialog-showmodal"}, "https://html.spec.whatwg.org/multipage/interactive-elements.html#the-details-element": {"displayText":"details","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"details","type":"element","url":"https://html.spec.whatwg.org/multipage/interactive-elements.html#the-details-element"}, "https://html.spec.whatwg.org/multipage/interactive-elements.html#the-dialog-element": {"displayText":"dialog","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"dialog","type":"element","url":"https://html.spec.whatwg.org/multipage/interactive-elements.html#the-dialog-element"}, "https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-href": {"displayText":"href","export":true,"for_":["a","area"],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"href","type":"element-attr","url":"https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-href"}, "https://html.spec.whatwg.org/multipage/media.html#audio": {"displayText":"audio","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"audio","type":"element","url":"https://html.spec.whatwg.org/multipage/media.html#audio"}, "https://html.spec.whatwg.org/multipage/media.html#concept-media-muted": {"displayText":"muted","export":true,"for_":["media element"],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"muted","type":"dfn","url":"https://html.spec.whatwg.org/multipage/media.html#concept-media-muted"}, "https://html.spec.whatwg.org/multipage/media.html#effective-media-volume": {"displayText":"effective media volume","export":true,"for_":["HTMLMediaElement"],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"effective media volume","type":"dfn","url":"https://html.spec.whatwg.org/multipage/media.html#effective-media-volume"}, "https://html.spec.whatwg.org/multipage/media.html#media-data": {"displayText":"media data","export":true,"for_":["HTMLMediaElement"],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"media data","type":"dfn","url":"https://html.spec.whatwg.org/multipage/media.html#media-data"}, "https://html.spec.whatwg.org/multipage/media.html#stall-timeout": {"displayText":"media element stall timeout","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"media element stall timeout","type":"dfn","url":"https://html.spec.whatwg.org/multipage/media.html#stall-timeout"}, "https://html.spec.whatwg.org/multipage/media.html#video": {"displayText":"video","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"video","type":"element","url":"https://html.spec.whatwg.org/multipage/media.html#video"}, "https://html.spec.whatwg.org/multipage/sections.html#the-h1-element": {"displayText":"h1","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"h1","type":"element","url":"https://html.spec.whatwg.org/multipage/sections.html#the-h1-element"}, "https://html.spec.whatwg.org/multipage/semantics-other.html#selector-user-invalid": {"displayText":":user-invalid","export":false,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":":user-invalid","type":"selector","url":"https://html.spec.whatwg.org/multipage/semantics-other.html#selector-user-invalid"}, "https://html.spec.whatwg.org/multipage/semantics.html#meta": {"displayText":"meta","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"meta","type":"element","url":"https://html.spec.whatwg.org/multipage/semantics.html#meta"}, "https://html.spec.whatwg.org/multipage/semantics.html#the-html-element": {"displayText":"html","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"html","type":"element","url":"https://html.spec.whatwg.org/multipage/semantics.html#the-html-element"}, "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element": {"displayText":"a","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"a","type":"element","url":"https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element"}, "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-em-element": {"displayText":"em","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"em","type":"element","url":"https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-em-element"}, "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-q-element": {"displayText":"q","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"q","type":"element","url":"https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-q-element"}, "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-span-element": {"displayText":"span","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"span","type":"element","url":"https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-span-element"}, "https://infra.spec.whatwg.org/#ascii-case-insensitive": {"displayText":"ASCII case-insensitive","export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"ascii case-insensitive","type":"dfn","url":"https://infra.spec.whatwg.org/#ascii-case-insensitive"}, "https://infra.spec.whatwg.org/#string-is": {"displayText":"identical to","export":true,"for_":["string"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"identical to","type":"dfn","url":"https://infra.spec.whatwg.org/#string-is"}, "https://url.spec.whatwg.org/#concept-url-fragment": {"displayText":"fragment","export":true,"for_":["url"],"level":"1","normative":true,"shortname":"url","spec":"url","status":"current","text":"fragment","type":"dfn","url":"https://url.spec.whatwg.org/#concept-url-fragment"}, "https://w3c.github.io/mathml-core/#dfn-math": {"displayText":"math","export":true,"for_":[],"level":"1","normative":true,"shortname":"mathml-core","spec":"mathml-core","status":"current","text":"math","type":"element","url":"https://w3c.github.io/mathml-core/#dfn-math"}, "https://www.w3.org/TR/css-pseudo-4/#tree-abiding": {"displayText":"tree-abiding","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-pseudo","spec":"css-pseudo-4","status":"snapshot","text":"tree-abiding","type":"dfn","url":"https://www.w3.org/TR/css-pseudo-4/#tree-abiding"}, "https://www.w3.org/TR/css-scoping-1/#selectordef-shadow": {"displayText":"::shadow","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-scoping","spec":"css-scoping-1","status":"snapshot","text":"::shadow","type":"selector","url":"https://www.w3.org/TR/css-scoping-1/#selectordef-shadow"}, "https://www.w3.org/TR/selectors-4/#typedef-forgiving-relative-selector-list": {"displayText":"<forgiving-relative-selector-list>","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"snapshot","text":"<forgiving-relative-selector-list>","type":"type","url":"https://www.w3.org/TR/selectors-4/#typedef-forgiving-relative-selector-list"}, }; function mkRefHint(link, ref) { const linkText = link.textContent; let dfnTextElements = ''; if (ref.displayText.toLowerCase() != linkText.toLowerCase()) { // Give the original term if it's being displayed in a different way. // But allow casing differences, they're insignificant. dfnTextElements = mk.li({}, mk.b({}, "Term: "), mk.span({}, ref.displayText) ); } const forList = ref.for_; let forListElements; if(forList.length == 0) { forListElements = []; } else if(forList.length == 1) { forListElements = mk.li({}, mk.b({}, "For: "), mk.span({}, forList[0]), ); } else { forListElements = mk.li({}, mk.b({}, "For: "), mk.ul({}, ...forList.map(forItem => mk.li({}, mk.span({}, forItem) ), ), ), ); } const url = ref.url; const safeUrl = encodeURIComponent(url); const hintPanel = mk.aside({ class: "ref-hint", id: `ref-hint-for-${safeUrl}`, "data-for": url, "aria-labelled-by": `ref-hint-for-${safeUrl}`, }, mk.ul({}, dfnTextElements, mk.li({}, mk.b({}, "URL: "), mk.a({ href: url, class: "ref" }, url), ), mk.li({}, mk.b({}, "Type: "), mk.span({}, `${ref.type}`), ), mk.li({}, mk.b({}, "Spec: "), mk.span({}, `${ref.spec ? ref.spec : ''}`), ), forListElements ), ); hintPanel.forLink = link; setupRefHintEventListeners(link, hintPanel); return hintPanel; } function hideAllRefHints() { queryAll(".ref-hint").forEach(el=>hideRefHint(el)); } function hideRefHint(refHint) { const link = refHint.forLink; link.setAttribute("aria-expanded", "false"); if(refHint.teardownEventListeners) { refHint.teardownEventListeners(); } refHint.remove(); } function showRefHint(link) { if(link.classList.contains("dfn-link")) return; const url = link.getAttribute("href"); const ref = refsData[url]; if(!ref) return; hideAllRefHints(); // Only display one at this time. const refHint = mkRefHint(link, ref); append(document.body, refHint); link.setAttribute("aria-expanded", "true"); positionRefHint(refHint); } function setupRefHintEventListeners(link, refHint) { if (refHint.teardownEventListeners) return; // Add event handlers to hide the refHint after the user moves away // from both the link and refHint, if not hovering either within one second. let timeout = null; const startHidingRefHint = (event) => { if (timeout) { clearTimeout(timeout); } timeout = setTimeout(() => { hideRefHint(refHint); }, 1000); } const resetHidingRefHint = (event) => { if (timeout) clearTimeout(timeout); timeout = null; }; link.addEventListener("mouseleave", startHidingRefHint); link.addEventListener("mouseenter", resetHidingRefHint); link.addEventListener("blur", startHidingRefHint); link.addEventListener("focus", resetHidingRefHint); refHint.addEventListener("mouseleave", startHidingRefHint); refHint.addEventListener("mouseenter", resetHidingRefHint); refHint.addEventListener("blur", startHidingRefHint); refHint.addEventListener("focus", resetHidingRefHint); refHint.teardownEventListeners = () => { // remove event listeners resetHidingRefHint(); link.removeEventListener("mouseleave", startHidingRefHint); link.removeEventListener("mouseenter", resetHidingRefHint); link.removeEventListener("blur", startHidingRefHint); link.removeEventListener("focus", resetHidingRefHint); refHint.removeEventListener("mouseleave", startHidingRefHint); refHint.removeEventListener("mouseenter", resetHidingRefHint); refHint.removeEventListener("blur", startHidingRefHint); refHint.removeEventListener("focus", resetHidingRefHint); }; } function positionRefHint(refHint) { const link = refHint.forLink; const linkPos = getBounds(link); refHint.style.top = linkPos.bottom + "px"; refHint.style.left = linkPos.left + "px"; const panelPos = refHint.getBoundingClientRect(); const panelMargin = 8; const maxRight = document.body.parentNode.clientWidth - panelMargin; if (panelPos.right > maxRight) { const overflowAmount = panelPos.right - maxRight; const newLeft = Math.max(panelMargin, linkPos.left - overflowAmount); refHint.style.left = newLeft + "px"; } } // TODO: shared util // Returns the root-level absolute position {left and top} of element. function getBounds(el, relativeTo=document.body) { const relativeRect = relativeTo.getBoundingClientRect(); const elRect = el.getBoundingClientRect(); const top = elRect.top - relativeRect.top; const left = elRect.left - relativeRect.left; return { top, left, bottom: top + elRect.height, right: left + elRect.width, } } function showRefHintListener(e) { // If the target isn't in a link (or is a link), // just ignore it. let link = e.target.closest("a"); if(!link) return; // If the target is in a ref-hint panel // (aka a link in the already-open one), // also just ignore it. if(link.closest(".ref-hint")) return; // Otherwise, show the panel for the link. showRefHint(link); } function hideAllHintsListener(e) { // If the click is inside a ref-hint panel, ignore it. if(e.target.closest(".ref-hint")) return; // Otherwise, close all the current panels. hideAllRefHints(); } document.addEventListener("DOMContentLoaded", () => { document.body.addEventListener("mousedown", showRefHintListener); document.body.addEventListener("focus", showRefHintListener); document.body.addEventListener("click", hideAllHintsListener); }); window.addEventListener("resize", () => { // Hide any open ref hint. hideAllRefHints(); }); } </script> <script>/* Boilerplate: script-var-click-highlighting */ "use strict"; { /* Color-choosing design: * Colors are ordered by goodness. * On clicking a var, give it the earliest color with the lowest usage in the algorithm. * On re-clicking, re-use the var's most recent color if that's not currently being used elsewhere. */ const COLOR_COUNT = 7; document.addEventListener("click", e=>{ if(e.target.nodeName == "VAR") { highlightSameAlgoVars(e.target); } }); function highlightSameAlgoVars(v) { // Find the algorithm container. let algoContainer = findAlgoContainer(v); // Not highlighting document-global vars, // too likely to be unrelated. if(algoContainer == null) return; const varName = nameFromVar(v); if(!v.hasAttribute("data-var-color")) { const newColor = chooseHighlightColor(algoContainer, v); for(const el of algoContainer.querySelectorAll("var")) { if(nameFromVar(el) == varName) { el.setAttribute("data-var-color", newColor); el.setAttribute("data-var-last-color", newColor); } } } else { for(const el of algoContainer.querySelectorAll("var")) { if(nameFromVar(el) == varName) { el.removeAttribute("data-var-color"); } } } } function findAlgoContainer(el) { while(el != document.body) { if(el.hasAttribute("data-algorithm")) return el; el = el.parentNode; } return null; } function nameFromVar(el) { return el.textContent.replace(/(\s|\xa0)+/g, " ").trim(); } function colorCountsFromContainer(container) { const namesFromColor = Array.from({length:COLOR_COUNT}, x=>new Set()); for(let v of container.querySelectorAll("var[data-var-color]")) { let color = +v.getAttribute("data-var-color"); namesFromColor[color].add(nameFromVar(v)); } return namesFromColor.map(x=>x.size); } function leastUsedColor(colors) { // Find the earliest color with the lowest count. let minCount = Infinity; let minColor = null; for(var i = 0; i < colors.length; i++) { if(colors[i] < minCount) { minColor = i; minCount = colors[i]; } } return minColor; } function chooseHighlightColor(container, v) { const colorCounts = colorCountsFromContainer(container); if(v.hasAttribute("data-var-last-color")) { let color = +v.getAttribute("data-var-last-color"); if(colorCounts[color] == 0) return color; } return leastUsedColor(colorCounts); } } </script>