CINXE.COM
CSS Generated Content Module Level 3
<!doctype html><html lang="en"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <title>CSS Generated Content Module Level 3</title> <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport"> <meta content="exploring" name="csswg-work-status"> <meta content="WD" name="w3c-status"> <meta content="This CSS3 Module describes how to insert content in a document." name="abstract"> <link href="default.css" rel="stylesheet" type="text/css"> <meta content="Bikeshed version 5a2c04fbf9f3418b378c5d733b60fe6fc575091b" name="generator"> <link href="https://www.w3.org/TR/css-content-3/" rel="canonical"> <meta content="c354339a1dc21ffedab7c2039e9a71c02e7cf04b" name="document-revision"> <style>/* 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>/* style-selflinks */ .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%; } 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: gray; color: white; font-style: normal; transition: opacity .2s, background-color .2s, color .2s; } dfn:hover > a.self-link { opacity: 1; } dfn > a.self-link:hover { color: black; } a.self-link::before { content: "¶"; } .heading > a.self-link::before { content: "§"; } dfn > a.self-link::before { content: "#"; }</style> <style>/* 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>/* style-autolinks */ .css.css, .property.property, .descriptor.descriptor { color: #005a9c; 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; }</style> <style>/* style-dfn-panel */ .dfn-panel { position: absolute; z-index: 35; height: auto; width: -webkit-fit-content; width: fit-content; max-width: 300px; max-height: 500px; overflow: auto; padding: 0.5em 0.75em; font: small Helvetica Neue, sans-serif, Droid Sans Fallback; background: #DDDDDD; color: black; border: outset 0.2em; } .dfn-panel:not(.on) { display: none; } .dfn-panel * { margin: 0; padding: 0; text-indent: 0; } .dfn-panel > b { display: block; } .dfn-panel a { color: black; } .dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; } .dfn-panel > b + b { margin-top: 0.25em; } .dfn-panel ul { padding: 0; } .dfn-panel li { list-style: inside; } .dfn-panel.activated { display: inline-block; position: fixed; left: .5em; bottom: 2em; margin: 0 auto; max-width: calc(100vw - 1.5em - .4em - .5em); max-height: 30vh; } .dfn-paneled { cursor: pointer; } </style> <style>/* style-syntax-highlighting */ .highlight:not(.idl) { background: hsl(24, 20%, 95%); } code.highlight { padding: .1em; border-radius: .3em; } pre.highlight, pre > code.highlight { display: block; padding: 1em; margin: .5em 0; overflow: auto; border-radius: 0; } 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 */ </style> <link href="https://www.w3.org/StyleSheets/TR/2016/W3C-WD" rel="stylesheet" type="text/css"> <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/2016/logos/W3C" width="72"> </a> </p> <h1 class="p-name no-ref" id="title">CSS Generated Content Module Level 3</h1> <h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">W3C Working Draft, <time class="dt-updated" datetime="2019-08-02">2 August 2019</time></span></h2> <div data-fill-with="spec-metadata"> <dl> <dt>This version: <dd><a class="u-url" href="https://www.w3.org/TR/2019/WD-css-content-3-20190802/">https://www.w3.org/TR/2019/WD-css-content-3-20190802/</a> <dt>Latest published version: <dd><a href="https://www.w3.org/TR/css-content-3/">https://www.w3.org/TR/css-content-3/</a> <dt>Editor's Draft: <dd><a href="https://drafts.csswg.org/css-content-3/">https://drafts.csswg.org/css-content-3/</a> <dt>Previous Versions: <dd><a href="https://www.w3.org/TR/2019/WD-css-content-3-20190710/" rel="prev">https://www.w3.org/TR/2019/WD-css-content-3-20190710/</a> <dt>Issue Tracking: <dd><a href="#issues-index">Inline In Spec</a> <dd><a href="https://github.com/w3c/csswg-drafts/labels/css-content-3">GitHub Issues</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">W3C Invited Expert</span>) <dd class="editor p-author h-card vcard" data-editor-id="65283"><a class="p-name fn u-email email" href="mailto:dauwhe@gmail.com">Dave Cramer</a> (<span class="p-org org">Hachette Livre</span>) <dt class="editor">Former Editors: <dd class="editor p-author h-card vcard"><a class="p-name fn u-email email" href="mailto:howcome@opera.com">Håkon Wium Lie</a> (<span class="p-org org">Opera Software</span>) <dd class="editor p-author h-card vcard"><a class="p-name fn u-email email" href="mailto:ian@hixie.ch">Ian Hickson</a> (<span class="p-org org">Google</span>) <dt>Suggest an Edit for this Spec: <dd><a href="https://github.com/w3c/csswg-drafts/blob/master/css-content-3/Overview.bs">GitHub Editor</a> </dl> </div> <div data-fill-with="warning"></div> <p class="copyright" data-fill-with="copyright"><a href="https://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2019 <a href="https://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="https://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="https://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="https://www.keio.ac.jp/">Keio</a>, <a href="https://ev.buaa.edu.cn/">Beihang</a>). W3C <a href="https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document">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>This CSS3 Module describes how to insert content in a document.</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. </div> <h2 class="no-num no-toc no-ref heading settled" id="status"><span class="content">Status of this document</span></h2> <div data-fill-with="status"> <p><em>This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the <a href="https://www.w3.org/TR/">W3C technical reports index at https://www.w3.org/TR/.</a></em> </p> <p>Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress. </p> <p><a href="https://github.com/w3c/csswg-drafts/issues">GitHub Issues</a> are preferred for discussion of this specification. When filing an issue, please put the text “css-content” in the title, preferably like this: “[css-content] <i data-lt>…summary of comment…</i>”. All issues and comments are <a href="https://lists.w3.org/Archives/Public/public-css-archive/">archived</a>, and there is also a <a href="https://lists.w3.org/Archives/Public/www-style/">historical archive</a>. </p> <p>This document was produced by the <a href="https://www.w3.org/Style/CSS/members">CSS Working Group</a>. </p> <p>This document was produced by a group operating under the <a href="https://www.w3.org/Consortium/Patent-Policy/">W3C Patent Policy</a>. W3C maintains a <a href="https://www.w3.org/2004/01/pp-impl/32061/status" rel="disclosure">public list of any patent disclosures</a> made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains <a href="https://www.w3.org/Consortium/Patent-Policy/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="https://www.w3.org/Consortium/Patent-Policy/#sec-Disclosure">section 6 of the W3C Patent Policy</a>.</p> <p>This document is governed by the <a href="https://www.w3.org/2019/Process-20190301/" id="w3c_process_revision">1 March 2019 W3C Process Document</a>.</p> <p></p> <p>This is a very rough draft, and is not ready for implementation.</p> </div> <div data-fill-with="at-risk"></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="#intro"><span class="secno"></span> <span class="content"> Introduction</span></a> <li> <a href="#content-property"><span class="secno">1</span> <span class="content"> Inserting and replacing content with the <span class="property">content</span> property</span></a> <ol class="toc"> <li><a href="#accessibility"><span class="secno">1.1</span> <span class="content"> Accessibility of Generated Content</span></a> <li><a href="#alt"><span class="secno">1.2</span> <span class="content"> Alternative Text for Accessibility</span></a> </ol> <li> <a href="#content-values"><span class="secno">2</span> <span class="content"> <span class="production" title="Expands to: <string> | close-quote | <image> | leader() | no-close-quote | no-open-quote | open-quote | contents"><content-list></span> Values and Functions</span></a> <ol class="toc"> <li><a href="#strings"><span class="secno">2.1</span> <span class="content"> String</span></a> <li><a href="#content-uri"><span class="secno">2.2</span> <span class="content"> <span class="production"><image></span></span></a> <li><a href="#element-content"><span class="secno">2.3</span> <span class="content"> Element Content</span></a> <li> <a href="#quotes"><span class="secno">2.4</span> <span class="content"> Quotes</span></a> <ol class="toc"> <li><a href="#quotes-property"><span class="secno">2.4.1</span> <span class="content"> Specifying quotes with the <span class="property">quotes</span> property</span></a> <li><a href="#quote-values"><span class="secno">2.4.2</span> <span class="content"> The *-quote values of the content property</span></a> </ol> <li> <a href="#leaders"><span class="secno">2.5</span> <span class="content"> Leaders</span></a> <ol class="toc"> <li><a href="#leader-function"><span class="secno">2.5.1</span> <span class="content"> The <span class="css">leader()</span> function</span></a> <li><a href="#leader-rules"><span class="secno">2.5.2</span> <span class="content"> Rendering leaders</span></a> <li><a href="#leader-alignment"><span class="secno">2.5.3</span> <span class="content"> Procedure for rendering leaders</span></a> </ol> <li> <a href="#cross-references"><span class="secno">2.6</span> <span class="content"> Cross references and the target-* functions</span></a> <ol class="toc"> <li><a href="#target-counter"><span class="secno">2.6.1</span> <span class="content"> The <span class="css">target-counter()</span> function</span></a> <li><a href="#target-counters"><span class="secno">2.6.2</span> <span class="content"> The <span class="css">target-counters()</span> function </span></a> <li><a href="#target-text"><span class="secno">2.6.3</span> <span class="content"> The <span class="css">target-text()</span> function</span></a> </ol> <li> <a href="#named-strings"><span class="secno">2.7</span> <span class="content"> Named strings</span></a> <ol class="toc"> <li><a href="#string-set"><span class="secno">2.7.1</span> <span class="content"> The string-set property</span></a> <li><a href="#string-function"><span class="secno">2.7.2</span> <span class="content"> The <span class="css">string()</span> function</span></a> <li><a href="#content-function"><span class="secno">2.7.3</span> <span class="content"> The <span class="css">content()</span> function</span></a> </ol> </ol> <li><a href="#counters"><span class="secno">3</span> <span class="content"> Automatic counters and numbering: the <span class="property">counter-increment</span> and <span class="property">counter-reset</span> properties (moved)</span></a> <li> <a href="#bookmark-generation"><span class="secno">4</span> <span class="content"> Bookmarks</span></a> <ol class="toc"> <li><a href="#bookmark-level"><span class="secno">4.1</span> <span class="content"> bookmark-level </span></a> <li><a href="#bookmark-label"><span class="secno">4.2</span> <span class="content"> bookmark-label</span></a> <li><a href="#bookmark-state"><span class="secno">4.3</span> <span class="content"> bookmark-state</span></a> </ol> <li><a href="#changes"><span class="secno">5</span> <span class="content">Changes since the 2 June 2016 Working Draft</span></a> <li><a href="#acknowledgements"><span class="secno"></span> <span class="content">Acknowledgements</span></a> <li> <a href="#conformance"><span class="secno"></span> <span class="content"> Conformance</span></a> <ol class="toc"> <li><a href="#document-conventions"><span class="secno"></span> <span class="content"> Document conventions</span></a> <li><a href="#conform-classes"><span class="secno"></span> <span class="content"> Conformance classes</span></a> <li> <a href="#conform-responsible"><span class="secno"></span> <span class="content"> Requirements for Responsible Implementation of CSS</span></a> <ol class="toc"> <li><a href="#conform-partial"><span class="secno"></span> <span class="content"> Partial Implementations</span></a> <li><a href="#conform-future-proofing"><span class="secno"></span> <span class="content"> Implementations of Unstable and Proprietary Features</span></a> <li><a href="#conform-testing"><span class="secno"></span> <span class="content"> Implementations of CR-level Features</span></a> </ol> </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="#property-index"><span class="secno"></span> <span class="content">Property Index</span></a> <li><a href="#issues-index"><span class="secno"></span> <span class="content">Issues Index</span></a> </ol> </nav> <main> <h2 class="no-num heading settled" id="intro"><span class="content"> Introduction</span></h2> <p>Authors sometimes want user agents to render content that does not come from the document tree. One familiar example of this is numbered headings; the author does not want to mark the numbers up explicitly, they want the user agent to generate them automatically. Counters and markers are used to achieve these effects.</p> <div class="example" id="example-47d87e9c"> <a class="self-link" href="#example-47d87e9c"></a> <pre class="highlight"><c- f>h1::before </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> <c- nf>counter</c-><c- p>(</c->section<c- p>)</c-> <c- s>": "</c-><c- p>;</c-> <c- p>}</c-> </pre> </div> <p>Similarly, authors may want the user agent to insert the word "Figure" before the caption of a figure, or "Chapter 7" on a line before the seventh chapter title.</p> <div class="example" id="example-5a4a3cc1"> <a class="self-link" href="#example-5a4a3cc1"></a> <pre class="highlight"><c- f>chapter </c-><c- p>{</c-> <c- k>counter-increment</c-><c- p>:</c-> chapter<c- p>;</c-> <c- p>}</c-> <c- f>chapter > title::before </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> <c- s>"Chapter "</c-> <c- nf>counter</c-><c- p>(</c->chapter<c- p>)</c-> <c- s>"\A"</c-><c- p>;</c-> <c- p>}</c-> </pre> </div> <p>Another common effect is replacing elements with images or other multimedia content. Since not all user agents support all multimedia formats, fallbacks may have to be provided.</p> <div class="example" id="example-856d72ea"> <a class="self-link" href="#example-856d72ea"></a> <pre class="highlight"><c- c>/* Replace <logo> elements with the site’s logo, using a format</c-> <c- c> * supported by the UA */</c-> <c- f>logo </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> <c- nf>url</c-><c- p>(</c-><c- s>logo.mov</c-><c- p>),</c-> <c- nf>url</c-><c- p>(</c-><c- s>logo.mng</c-><c- p>),</c-> <c- nf>url</c-><c- p>(</c-><c- s>logo.png</c-><c- p>),</c-> none<c- p>;</c-> <c- p>}</c-> <c- c>/* Replace <figure> elements with the referenced document, or,</c-> <c- c> * failing that, with either the contents of the alt attribute or the</c-> <c- c> * contents of the element itself if there is no alt attribute */</c-> <c- f>figure[alt] </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> <c- nf>attr</c-><c- p>(</c->href url<c- p>),</c-> <c- nf>attr</c-><c- p>(</c->alt<c- p>);</c-> <c- p>}</c-> <c- f>figure:not([alt]) </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> <c- nf>attr</c-><c- p>(</c->href url<c- p>),</c-> contents<c- p>;</c-> <c- p>}</c-> </pre> </div> <h2 class="heading settled" data-level="1" id="content-property"><span class="secno">1. </span><span class="content"> Inserting and replacing content with the <a class="property" data-link-type="propdesc" href="#propdef-content" id="ref-for-propdef-content">content</a> property</span><a class="self-link" href="#content-property"></a></h2> <table class="def propdef" data-link-for-hint="content"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-content">content</dfn> <tr class="value"> <th><a href="https://drafts.csswg.org/css-values/#value-defs">Value:</a> <td class="prod">normal <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one">|</a> none <span id="ref-for-comb-one①">|</span> [ <a class="production css" data-link-type="type" href="#typedef-content-content-replacement" id="ref-for-typedef-content-content-replacement"><content-replacement></a> <span id="ref-for-comb-one②">|</span> <a class="production css" data-link-type="type" href="#typedef-content-content-list" id="ref-for-typedef-content-content-list" title="Expands to: <string> | close-quote | <image> | leader() | no-close-quote | no-open-quote | open-quote | contents"><content-list></a> ] [/ [ <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-values/#string-value" id="ref-for-string-value"><string></a> <span id="ref-for-comb-one③">|</span> <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-lists-3/#typedef-counter" id="ref-for-typedef-counter"><counter></a> ]<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-one-plus" id="ref-for-mult-one-plus">+</a> ]<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-opt" id="ref-for-mult-opt">?</a> <tr> <th><a href="https://drafts.csswg.org/css-cascade/#initial-values">Initial:</a> <td>normal <tr> <th>Applies to: <td>all elements, tree-abiding pseudo-elements, and page margin boxes <tr> <th><a href="https://drafts.csswg.org/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://drafts.csswg.org/css-values/#percentages">Percentages:</a> <td>n/a <tr> <th><a href="https://drafts.csswg.org/css-cascade/#computed">Computed value:</a> <td>See prose below <tr> <th>Canonical order: <td>per grammar <tr> <th><a href="https://drafts.csswg.org/web-animations/#animation-type">Animation type:</a> <td>discrete </table> <p class="all-media">User Agents are expected to support this property on all media, including non-visual ones.</p> <p>The <a class="property" data-link-type="propdesc" href="#propdef-content" id="ref-for-propdef-content①">content</a> property dictates what is rendered inside an element or pseudo-element.</p> <p>For elements, it has only one purpose: specifying that the element renders as normal, or replacing the element with an image (and possibly some associated "alt text").</p> <p>For pseudo-elements and margin boxes, it is more powerful. It controls whether the element renders at all, can replace the element with an image, or replace it with arbitrary inline content (text and images).</p> <dl> <dt><dfn class="dfn-paneled css" data-dfn-for="content" data-dfn-type="value" data-export id="valdef-content-normal">normal</dfn> <dd> For an element or page margin box, this computes to <a class="css" data-link-type="maybe" href="#valdef-content-contents" id="ref-for-valdef-content-contents">contents</a>. <p>For <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-pseudo-4/#selectordef-before" id="ref-for-selectordef-before">::before</a> and <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-pseudo-4/#selectordef-after" id="ref-for-selectordef-after">::after</a>, this computes to <a class="css" data-link-type="maybe" href="#valdef-content-none" id="ref-for-valdef-content-none">none</a>.</p> <p>For <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-pseudo-4/#selectordef-marker" id="ref-for-selectordef-marker">::marker</a>, this computes to itself (<a class="css" data-link-type="maybe" href="#valdef-content-normal" id="ref-for-valdef-content-normal">normal</a>).</p> <dt><dfn class="dfn-paneled css" data-dfn-for="content" data-dfn-type="value" data-export id="valdef-content-none">none</dfn> <dd> On elements, this inhibits the children of the element from being rendered as children of this element, as if the element was empty. <p>On pseudo-elements it inhibits the creation of the pseudo-element as if it had <a class="css" data-link-type="propdesc" href="https://www.w3.org/TR/css-ruby-1/#propdef-display" id="ref-for-propdef-display">display: none</a>.</p> <p>In neither case does it prevent any pseudo-elements which have this element or pseudo-element as an <a data-link-type="dfn" href="https://www.w3.org/TR/selectors4/#originating-element" id="ref-for-originating-element">originating element</a> from being generated.</p> <dt><dfn class="dfn-paneled css" data-dfn-for="content" data-dfn-type="type" data-export id="typedef-content-content-replacement"><a class="production css" data-link-type="type" href="#typedef-content-content-replacement" id="ref-for-typedef-content-content-replacement①"><content-replacement></a></dfn> <dd id="replaced"> Equal to: <pre class="prod highlight"><a class="production" data-link-type="type" href="https://www.w3.org/TR/css3-images/#image-type" id="ref-for-image-type"><image></a></pre> <p>Makes the element or pseudo-element a <a href="https://www.w3.org/TR/CSS2/conform.html#replaced-element">replaced element</a>, filled with the specified <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-images/#image-type" id="ref-for-image-type①"><image></a>. Its normal contents are suppressed and do not generate boxes, as if they were <a class="css" data-link-type="propdesc" href="https://www.w3.org/TR/css-ruby-1/#propdef-display" id="ref-for-propdef-display①">display: none</a>.</p> <p>If the <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-images/#image-type" id="ref-for-image-type②"><image></a> represents an <a data-link-type="dfn" href="https://www.w3.org/TR/css4-images/#invalid-image" id="ref-for-invalid-image">invalid image</a>, then it must be treated as instead representing an image with zero intrinsic width and height, filled with transparent black.</p> <p class="issue" id="issue-b8fd18a9"><a class="self-link" href="#issue-b8fd18a9"></a> The above <a data-link-type="dfn" href="https://www.w3.org/TR/css4-images/#invalid-image" id="ref-for-invalid-image①">invalid image</a> behavior appears to be what Chrome is doing. Is this okay? Is there a better behavior we can/should use?</p> <p class="issue" id="issue-76d40dad"><a class="self-link" href="#issue-76d40dad"></a> "Zero intrinsic width and height" gives it an undefined aspect ratio, and sizing behavior is thus... undefined. At least, if you give it an explicit width or height, the other dimension remains at zero in Chrome. This might need to be explicitly defined over in the Images spec; needs some investigation around whether browsers act this way for 0x0 SVGs and rasters.</p> <p class="note" role="note"><span>Note:</span> Replaced elements use different layout rules than normal elements. (In effect, it becomes equivalent to an HTML <code class="highlight"><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.)</p> <p class="note" role="note"><span>Note:</span> Replaced elements do not have <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-pseudo-4/#selectordef-before" id="ref-for-selectordef-before①">::before</a> or <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-pseudo-4/#selectordef-after" id="ref-for-selectordef-after①">::after</a> pseudo-elements; the <a class="property" data-link-type="propdesc" href="#propdef-content" id="ref-for-propdef-content②">content</a> property replaces their entire contents.</p> <dt><dfn class="dfn-paneled css" data-dfn-for="content" data-dfn-type="type" data-export id="typedef-content-content-list"><a class="production css" data-link-type="type" href="#typedef-content-content-list" id="ref-for-typedef-content-content-list①" title="Expands to: <string> | close-quote | <image> | leader() | no-close-quote | no-open-quote | open-quote | contents"><content-list></a></dfn> <dd> Equal to: <pre class="prod highlight">[ <a class="production" data-link-type="type" href="https://www.w3.org/TR/css3-values/#string-value" id="ref-for-string-value①"><string></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one④">|</a> contents <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑤">|</a> <a class="production" data-link-type="type" href="https://www.w3.org/TR/css3-images/#image-type" id="ref-for-image-type③"><image></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑥">|</a> <a class="production" data-link-type="type" href="https://www.w3.org/TR/css-lists-3/#typedef-counter" id="ref-for-typedef-counter①"><counter></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑦">|</a> <a class="production" data-link-type="type" href="#typedef-quote" id="ref-for-typedef-quote" title="Expands to: no-open-quote | no-close-quote | close-quote | open-quote"><quote></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑧">|</a> <a class="production" data-link-type="type" href="#typedef-target" id="ref-for-typedef-target"><target></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑨">|</a> <a class="production" data-link-type="function"><leader()></a> ]<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-one-plus" id="ref-for-mult-one-plus①">+</a> </pre> <p>Replaces the element’s contents with one or more anonymous inline boxes corresponding to the specified values, in the order specified. Its normal contents are suppressed and do not generate boxes, as if they were <a class="css" data-link-type="propdesc" href="https://www.w3.org/TR/css-ruby-1/#propdef-display" id="ref-for-propdef-display②">display: none</a>.</p> <p>Each value contributes an inline box to the element’s contents. For <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-images/#image-type" id="ref-for-image-type④"><image></a>, this is an inline anonymous replaced element; for the others, it’s an anonymous inline run of text.</p> <p>If an <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-images/#image-type" id="ref-for-image-type⑤"><image></a> represents an <a data-link-type="dfn" href="https://www.w3.org/TR/css4-images/#invalid-image" id="ref-for-invalid-image②">invalid image</a>, the user agent must do one of the following:</p> <ul> <li data-md> <p>"Skip" the <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-images/#image-type" id="ref-for-image-type⑥"><image></a>, generating nothing for it.</p> <li data-md> <p>Display some indication that the image can’t be displayed in place of the <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-images/#image-type" id="ref-for-image-type⑦"><image></a>, such as a "broken image" icon.</p> </ul> <p>This specification intentionally does not define which behavior a user agent must use, but it must use one or the other consistently.</p> <p class="note" role="note"><span>Note:</span> If the value of <a class="production css" data-link-type="type" href="#typedef-content-content-list" id="ref-for-typedef-content-content-list②" title="Expands to: <string> | close-quote | <image> | leader() | no-close-quote | no-open-quote | open-quote | contents"><content-list></a> is a single <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-images/#image-type" id="ref-for-image-type⑧"><image></a>, it must instead be interpreted as a <a class="production css" data-link-type="type" href="#typedef-content-content-replacement" id="ref-for-typedef-content-content-replacement②"><content-replacement></a>.</p> <dt><dfn class="css" data-dfn-for="content" data-dfn-type="value" data-export id="valdef-content---string--counter">/ [ <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-values/#string-value" id="ref-for-string-value②"><string></a> | <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-lists-3/#typedef-counter" id="ref-for-typedef-counter②"><counter></a> ]+<a class="self-link" href="#valdef-content---string--counter"></a></dfn> <dd> Specifies the "alt text" for the element. See <a href="#alt">§ 1.2 Alternative Text for Accessibility</a> for details. If omitted, the element has no "alt text". </dl> <p class="issue" id="issue-a8fbc981"><a class="self-link" href="#issue-a8fbc981"></a> Should the contents keyword be replaced with <a class="css" data-link-type="maybe" href="#funcdef-content" id="ref-for-funcdef-content">content()</a>?</p> <h3 class="heading settled" data-level="1.1" id="accessibility"><span class="secno">1.1. </span><span class="content"> Accessibility of Generated Content</span><a class="self-link" href="#accessibility"></a></h3> <p>Generated content should be searchable, selectable, and available to assistive technologies. The <a class="property" data-link-type="propdesc" href="#propdef-content" id="ref-for-propdef-content③">content</a> property applies to speech and generated content must be rendered for speech output. <a data-link-type="biblio" href="#biblio-css3-speech">[CSS3-SPEECH]</a></p> <p class="issue" id="issue-9c60e2c1"><a class="self-link" href="#issue-9c60e2c1"></a> Start work on an AAM for CSS.</p> <h3 class="heading settled" data-level="1.2" id="alt"><span class="secno">1.2. </span><span class="content"> Alternative Text for Accessibility</span><a class="self-link" href="#alt"></a></h3> <p>Content intended for visual media sometimes needs alternative text for speech output or other non-visual mediums. The <a class="property" data-link-type="propdesc" href="#propdef-content" id="ref-for-propdef-content④">content</a> property thus accepts alternative text to be specified after a slash (<span class="css">/</span>) after the last <a class="production css" data-link-type="type" href="#typedef-content-content-list" id="ref-for-typedef-content-content-list③" title="Expands to: <string> | close-quote | <image> | leader() | no-close-quote | no-open-quote | open-quote | contents"><content-list></a>. If such alternative text is provided, it must be used for speech output instead.</p> <p>This allows, for example, purely decorative text to be elided in speech output (by providing the empty string as alternative text), and allows authors to provide more readable alternatives to images, icons, or text-encoded symbols.</p> <div class="example" id="example-ff5073a7"> <a class="self-link" href="#example-ff5073a7"></a> Here the content property is an image, so the alt value is required to provide alternative text. <pre class="highlight"><c- f>.new::before </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> <c- nf>url</c-><c- p>(</c-><c- s>./img/star.png</c-><c- p>)</c-> <c- p>/</c-> <c- s>"New!"</c-><c- p>;</c-> <c- c>/* or a localized attribute from the DOM: attr("data-alt") */</c-> <c- p>}</c-> </pre> </div> <div class="example" id="example-954890b1"> <a class="self-link" href="#example-954890b1"></a> If the pseudo-element is purely decorative and its function is covered elsewhere, setting alt to the empty string can avoid reading out the decorative element. Here the ARIA attribute will be spoken as "collapsed". Without the empty string alt value, the content would also be spoken as "Black right-pointing pointer". <pre class="highlight"><c- f>.expandable::before </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> <c- s>"\25BA"</c-> <c- p>/</c-> <c- s>""</c-><c- p>;</c-> <c- c>/* a.k.a. ► */</c-> <c- c>/* aria-expanded="false" already in DOM,</c-> <c- c> so this pseudo-element is decorative */</c-> <c- p>}</c-> </pre> </div> <h2 class="heading settled" data-level="2" id="content-values"><span class="secno">2. </span><span class="content"> <a class="production css" data-link-type="type" href="#typedef-content-content-list" id="ref-for-typedef-content-content-list④" title="Expands to: <string> | close-quote | <image> | leader() | no-close-quote | no-open-quote | open-quote | contents"><content-list></a> Values and Functions</span><a class="self-link" href="#content-values"></a></h2> <p>The <a class="production css" data-link-type="type" href="#typedef-content-content-list" id="ref-for-typedef-content-content-list⑤" title="Expands to: <string> | close-quote | <image> | leader() | no-close-quote | no-open-quote | open-quote | contents"><content-list></a> value is used in <a class="property" data-link-type="propdesc" href="#propdef-content" id="ref-for-propdef-content⑤">content</a> to fill an element with one or more anonymous inline boxes, including images, strings, the values of counters, and the text value of elements. In this section we enumerate the possibilities.</p> <h3 class="heading settled" data-level="2.1" id="strings"><span class="secno">2.1. </span><span class="content"> String</span><a class="self-link" href="#strings"></a></h3> <dl> <dt><dfn class="css" data-dfn-for="content, <content-list>" data-dfn-type="value" data-export id="valdef-content-string"><a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-values/#string-value" id="ref-for-string-value③"><string></a><a class="self-link" href="#valdef-content-string"></a></dfn> <dd> Represents an anonymous inline box filled with the specified text. <p class="note" role="note"><span>Note:</span> <a data-link-type="dfn" href="https://www.w3.org/TR/css-text-3/#white-space" id="ref-for-white-space">White space</a> in the string is handled the same as in literal text, and controlled by the properties in <a data-link-type="biblio" href="#biblio-css-text-3">[CSS-TEXT-3]</a> and elsewhere. In particular, <span id="ref-for-white-space①">white space</span> character can collapse, even across multiple strings, such as in <a class="css" data-link-type="propdesc" href="#propdef-content" id="ref-for-propdef-content⑥">content: "First " " Second";</a>, which by default will render similar to <code class="highlight">"First Second"</code> (with a single visible space between the two words).</p> </dl> <h3 class="heading settled" data-level="2.2" id="content-uri"><span class="secno">2.2. </span><span class="content"> <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-images/#image-type" id="ref-for-image-type⑨"><image></a></span><a class="self-link" href="#content-uri"></a></h3> <dl> <dt><dfn class="css" data-dfn-for="<content-list>" data-dfn-type="value" data-export id="valdef-content-list-image"><a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-images/#image-type" id="ref-for-image-type①⓪"><image></a><a class="self-link" href="#valdef-content-list-image"></a></dfn> <dd> Represents an anonymous inline replaced element filled with the specified <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-images/#image-type" id="ref-for-image-type①①"><image></a>. <p>If the <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-images/#image-type" id="ref-for-image-type①②"><image></a> represents an <a data-link-type="dfn" href="https://www.w3.org/TR/css4-images/#invalid-image" id="ref-for-invalid-image③">invalid image</a>, this value instead represents nothing. (No inline content is added to the element, as if this value were "skipped".)</p> </dl> <p class="issue" id="issue-3ef3081c"><a class="self-link" href="#issue-3ef3081c"></a> CSS2.1 explicitly allowed the UA to substitute a broken image icon if the image was invalid. However, no browser appears to do this. Is this removal okay?</p> <h3 class="heading settled" data-level="2.3" id="element-content"><span class="secno">2.3. </span><span class="content"> Element Content</span><a class="self-link" href="#element-content"></a></h3> <dl> <dt><dfn class="dfn-paneled css" data-dfn-for="content, <content-list>" data-dfn-type="value" data-export id="valdef-content-contents">contents</dfn> <dd> The element’s descendents. Since this can only be used once per element (you can’t duplicate the children if, e.g., one is a plugin or form control), it is handled as follows: <dl> <dt data-md>If set on the element: <dd data-md> <p>Always honoured. Note that this is the default, since the initial value of <a class="property" data-link-type="propdesc" href="#propdef-content" id="ref-for-propdef-content⑦">content</a> is <a class="css" data-link-type="maybe" href="#valdef-content-normal" id="ref-for-valdef-content-normal①">normal</a> and <span class="css" id="ref-for-valdef-content-normal②">normal</span> computes to <a class="css" data-link-type="maybe" href="#valdef-content-contents" id="ref-for-valdef-content-contents①">contents</a> on an element.</p> <dt data-md>If set on one of the element’s other pseudo-elements: <dd data-md> <p>Check to see that it is not set on a "previous" pseudo-element, in the following order, depth first:</p> <ol> <li data-md> <p>the element itself</p> <li data-md> <p>::before</p> <li data-md> <p>::after</p> </ol> <p class="issue" id="issue-bf2f178e"><a class="self-link" href="#issue-bf2f178e"></a> Should this behave as an empty string on pseudo-elements?</p> <p>If it is already used, then it evaluates to nothing (like <a class="css" data-link-type="maybe" href="#valdef-content-none" id="ref-for-valdef-content-none①">none</a>). Only pseudo-elements that are actually generated are checked.</p> </dl> </dl> <div class="example" id="example-765061ba"> <a class="self-link" href="#example-765061ba"></a> In the following case: <pre class="highlight"><c- f>foo </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> normal<c- p>;</c-> <c- p>}</c-> <c- c>/* this is the initial value */</c-> <c- f>foo::after </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> contents<c- p>;</c-> <c- p>}</c-> </pre> <p>...the element’s <a class="property" data-link-type="propdesc" href="#propdef-content" id="ref-for-propdef-content⑧">content</a> property would compute to <a class="css" data-link-type="maybe" href="#valdef-content-contents" id="ref-for-valdef-content-contents②">contents</a> and the after pseudo element would have no contents (equivalent to <a class="css" data-link-type="maybe" href="#valdef-content-none" id="ref-for-valdef-content-none②">none</a>) and thus would not appear.</p> <pre class="highlight"><c- f>foo </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> none<c- p>;</c-> <c- p>}</c-> <c- f>foo::after </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> contents<c- p>;</c-> <c- p>}</c-> </pre> <p>But in this example, the ::after pseudo-element will contain the contents of the foo element.</p> </div> <p class="issue" id="issue-bfc60bbc"><a class="self-link" href="#issue-bfc60bbc"></a> Use cases for suppressing the content on the element and using it in a pseudo-element would be welcome.</p> <p class="note" role="note"><span>Note:</span> While it is useless to include <a class="css" data-link-type="maybe" href="#valdef-content-contents" id="ref-for-valdef-content-contents③">contents</a> twice in a single <a class="property" data-link-type="propdesc" href="#propdef-content" id="ref-for-propdef-content⑨">content</a> property, that is not a parse error. The second occurrence simply has no effect, as it has already been used. It is also not a parse error to use it on a <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-pseudo-4/#selectordef-marker" id="ref-for-selectordef-marker①">::marker</a> pseudo-element, it is only during the rendering stage that it gets treated like <a class="css" data-link-type="maybe" href="#valdef-content-none" id="ref-for-valdef-content-none③">none</a>.</p> <p class="issue" id="issue-9fa9cc25"><a class="self-link" href="#issue-9fa9cc25"></a> Do we need the statement about marker pseudo-elements here? Or is this legacy from the old version of the spec?</p> <h3 class="heading settled" data-level="2.4" id="quotes"><span class="secno">2.4. </span><span class="content"> Quotes</span><a class="self-link" href="#quotes"></a></h3> <p>HTML has long had the <code class="highlight">q</code> element, used to delimit quotations. The <span class="css">quotes</span> property, in conjunction with the various <span class="css">*-quote</span> values of the <a class="property" data-link-type="propdesc" href="#propdef-content" id="ref-for-propdef-content①⓪">content</a> property, can be used to properly style such quotations.</p> <h4 class="heading settled" data-level="2.4.1" id="quotes-property"><span class="secno">2.4.1. </span><span class="content"> Specifying quotes with the <a class="property" data-link-type="propdesc" href="#propdef-quotes" id="ref-for-propdef-quotes">quotes</a> property</span><a class="self-link" href="#quotes-property"></a></h4> <table class="def propdef" data-link-for-hint="quotes"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-quotes">quotes</dfn> <tr class="value"> <th><a href="https://drafts.csswg.org/css-values/#value-defs">Value:</a> <td class="prod">auto <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①⓪">|</a> none <span id="ref-for-comb-one①①">|</span> [ <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-values/#string-value" id="ref-for-string-value④"><string></a> <span class="production" id="ref-for-string-value⑤"><string></span> ]<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-one-plus" id="ref-for-mult-one-plus②">+</a> <tr> <th><a href="https://drafts.csswg.org/css-cascade/#initial-values">Initial:</a> <td>auto <tr> <th>Applies to: <td><a href="https://drafts.csswg.org/css-pseudo/#generated-content" title="Includes ::before and ::after pseudo-elements.">all elements</a> <tr> <th><a href="https://drafts.csswg.org/css-cascade/#inherited-property">Inherited:</a> <td>yes <tr> <th><a href="https://drafts.csswg.org/css-values/#percentages">Percentages:</a> <td>n/a <tr> <th><a href="https://drafts.csswg.org/css-cascade/#computed">Computed value:</a> <td>the keyword <a class="css" data-link-type="maybe" href="#valdef-quotes-none" id="ref-for-valdef-quotes-none">none</a>, the keyword <a class="css" data-link-type="maybe" href="#valdef-quotes-auto" id="ref-for-valdef-quotes-auto">auto</a>, or a list, each item a pair of string values <tr> <th>Canonical order: <td>per grammar <tr> <th><a href="https://drafts.csswg.org/web-animations/#animation-type">Animation type:</a> <td>discrete </table> <p class="all-media">User Agents are expected to support this property on all media, including non-visual ones.</p> <p>This property specifies quotation marks for any number of embedded quotations. Values have the following meanings:</p> <dl> <dt><dfn class="dfn-paneled css" data-dfn-for="quotes" data-dfn-type="value" data-export id="valdef-quotes-none">none</dfn> <dd> The <a class="css" data-link-type="maybe" href="#valdef-content-open-quote" id="ref-for-valdef-content-open-quote">open-quote</a> and <a class="css" data-link-type="maybe" href="#valdef-content-close-quote" id="ref-for-valdef-content-close-quote">close-quote</a> values of the <a class="property" data-link-type="propdesc" href="#propdef-content" id="ref-for-propdef-content①①">content</a> property produce no quotations marks, as if they were <a class="css" data-link-type="maybe" href="#valdef-content-no-open-quote" id="ref-for-valdef-content-no-open-quote">no-open-quote</a> and <a class="css" data-link-type="maybe" href="#valdef-content-no-close-quote" id="ref-for-valdef-content-no-close-quote">no-close-quote</a> respectively. <dt><dfn class="dfn-paneled css" data-dfn-for="quotes" data-dfn-type="value" data-export id="valdef-quotes-auto">auto</dfn> <dd> A typographically appropriate <a data-link-type="dfn" href="https://www.w3.org/TR/css-cascade-4/#used-value" id="ref-for-used-value">used value</a> for <a class="property" data-link-type="propdesc" href="#propdef-quotes" id="ref-for-propdef-quotes①">quotes</a> is automatically chosen by the UA based on the <a data-link-type="dfn" href="https://www.w3.org/TR/css-text-3/#content-language" id="ref-for-content-language">content language</a> of the element and/or its parent. <p class="note" role="note"><span>Note:</span> The Unicode Common Locale Data Repository <a data-link-type="biblio" href="#biblio-cldr">[CLDR]</a> maintains information on typographically apropriate quotation marks. UAs can use other sources of information as well, particularly as typographic preferences can vary; however it is encouraged to submit any improvements to Unicode so that the entire software ecosystem can benefit.</p> <dt>[ <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-values/#string-value" id="ref-for-string-value⑥"><string></a> <span class="production" id="ref-for-string-value⑦"><string></span> ]+ <dd> Values for the <a class="css" data-link-type="maybe" href="#valdef-content-open-quote" id="ref-for-valdef-content-open-quote①">open-quote</a> and <a class="css" data-link-type="maybe" href="#valdef-content-close-quote" id="ref-for-valdef-content-close-quote①">close-quote</a> values of the <a class="property" data-link-type="propdesc" href="#propdef-content" id="ref-for-propdef-content①②">content</a> property are taken from this list of pairs of quotation marks (opening and closing). The first (leftmost) pair represents the outermost level of quotation, the second pair the first level of embedding, etc. The user agent must apply the appropriate pair of quotation marks according to the level of embedding. </dl> <h4 class="heading settled" data-level="2.4.2" id="quote-values"><span class="secno">2.4.2. </span><span class="content"> The *-quote values of the content property</span><a class="self-link" href="#quote-values"></a></h4> <pre class="prod highlight"><dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-quote"><a class="production" data-link-type="type" href="#typedef-quote" id="ref-for-typedef-quote①" title="Expands to: no-open-quote | no-close-quote | close-quote | open-quote"><quote></a></dfn> = open-quote <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①②">|</a> close-quote <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①③">|</a> no-open-quote <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①④">|</a> no-close-quote </pre> <dl> <dt><dfn class="dfn-paneled css" data-dfn-for="content, <content-list>, <quote>" data-dfn-type="value" data-export id="valdef-content-open-quote">open-quote</dfn> <dt><dfn class="dfn-paneled css" data-dfn-for="content, <content-list>, <quote>" data-dfn-type="value" data-export id="valdef-content-close-quote">close-quote</dfn> <dd> These values are replaced by the appropriate string from the <a class="property" data-link-type="propdesc" href="#propdef-quotes" id="ref-for-propdef-quotes②">quotes</a> property, and increments (decrements) the level of nesting for quotes. See <a href="#quotes-property">§ 2.4.1 Specifying quotes with the quotes property</a> for more information. <dt><dfn class="dfn-paneled css" data-dfn-for="content, <content-list>, <quote>" data-dfn-type="value" data-export id="valdef-content-no-open-quote">no-open-quote</dfn> <dt><dfn class="dfn-paneled css" data-dfn-for="content, <content-list>, <quote>" data-dfn-type="value" data-export id="valdef-content-no-close-quote">no-close-quote</dfn> <dd> Inserts nothing (as in <a class="css" data-link-type="maybe" href="#valdef-content-none" id="ref-for-valdef-content-none④">none</a>), but increments (decrements) the level of nesting for quotes. See <a href="#quotes-property">§ 2.4.1 Specifying quotes with the quotes property</a> for more information. </dl> <p>Quotation marks are inserted in appropriate places in a document with the <a class="css" data-link-type="maybe" href="#valdef-content-open-quote" id="ref-for-valdef-content-open-quote②">open-quote</a> and <a class="css" data-link-type="maybe" href="#valdef-content-close-quote" id="ref-for-valdef-content-close-quote②">close-quote</a> values of the <a class="property" data-link-type="propdesc" href="#propdef-content" id="ref-for-propdef-content①③">content</a> property. Each occurrence of <span class="css" id="ref-for-valdef-content-open-quote③">open-quote</span> or <span class="css" id="ref-for-valdef-content-close-quote③">close-quote</span> is replaced by one of the strings from the value of <a class="property" data-link-type="propdesc" href="#propdef-quotes" id="ref-for-propdef-quotes③">quotes</a>, based on the depth of nesting.</p> <p><a class="css" data-link-type="maybe" href="#valdef-content-open-quote" id="ref-for-valdef-content-open-quote④">open-quote</a> refers to the first of a pair of quotes, <a class="css" data-link-type="maybe" href="#valdef-content-close-quote" id="ref-for-valdef-content-close-quote④">close-quote</a> refers to the second. Which pair of quotes is used depends on the nesting level of quotes: the number of occurrences of <span class="css" id="ref-for-valdef-content-open-quote⑤">open-quote</span> in all generated text before the current occurrence, minus the number of occurrences of <span class="css" id="ref-for-valdef-content-close-quote⑤">close-quote</span>. If the depth is 0, the first pair is used, if the depth is 1, the second pair is used, etc. If the depth is greater than the number of pairs, the last pair is repeated.</p> <p>Note that this quoting depth is independent of the nesting of the source document or the formatting structure.</p> <p class="note" role="note"><span>Note:</span> Quote nesting, like <a href="https://drafts.csswg.org/css-lists-3/#inheriting-counters">counter inheritance</a>, operates on the “flattened element tree” in the context of the <a data-link-type="biblio" href="#biblio-dom">[DOM]</a>.</p> <p>Some typographic styles require open quotation marks to be repeated before every paragraph of a quote spanning several paragraphs, but only the last paragraph ends with a closing quotation mark. In CSS, this can be achieved by inserting "phantom" closing quotes. The keyword <a class="css" data-link-type="maybe" href="#valdef-content-no-close-quote" id="ref-for-valdef-content-no-close-quote①">no-close-quote</a> decrements the quoting level, but does not insert a quotation mark.</p> <div class="example" id="example-ebcea9ad"> <a class="self-link" href="#example-ebcea9ad"></a> The following style sheet puts opening quotation marks on every paragraph in a <code class="highlight">blockquote</code>, and inserts a single closing quote at the end: <pre class="highlight"><c- f>blockquote p:before </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> open-quote <c- p>}</c-> <c- f>blockquote p:after </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> no-close-quote <c- p>}</c-> <c- f>blockquote p:last-child::after </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> close-quote <c- p>}</c-> </pre> </div> <p>For symmetry, there is also a <a class="css" data-link-type="maybe" href="#valdef-content-no-open-quote" id="ref-for-valdef-content-no-open-quote①">no-open-quote</a> keyword, which inserts nothing, but increments the quotation depth by one.</p> <p class="note" role="note"><span>Note:</span> If a quotation is in a different language than the surrounding text, it is customary to quote the text with the quote marks of the language of the surrounding text, not the language of the quotation itself.</p> <div class="example" id="example-95fc1afb"> <a class="self-link" href="#example-95fc1afb"></a> For example, French inside English: <blockquote> The device of the order of the garter is “Honi soit qui mal y pense.” </blockquote> <p>English inside French:</p> <blockquote> Il disait: « Il faut mettre l’action en ‹ fast forward ›. » </blockquote> <p>A style sheet like the following will set the <a class="property" data-link-type="propdesc" href="#propdef-quotes" id="ref-for-propdef-quotes④">quotes</a> property so that <a class="css" data-link-type="maybe" href="#valdef-content-open-quote" id="ref-for-valdef-content-open-quote⑥">open-quote</a> and <a class="css" data-link-type="maybe" href="#valdef-content-close-quote" id="ref-for-valdef-content-close-quote⑥">close-quote</a> will work correctly on all elements. These rules are for documents that contain only English, French, or both. One rule is needed for every additional language. Note the use of the child combinator (">") to set quotes on elements based on the language of the surrounding text:</p> <pre class="highlight"><c- f>:lang(fr) > * </c-><c- p>{</c-> <c- k>quotes</c-><c- p>:</c-> <c- s>"\00AB\2005"</c-> <c- s>"\2005\00BB"</c-> <c- s>"\2039\2005"</c-> <c- s>"\2005\203A"</c-> <c- p>}</c-> <c- f>:lang(en) > * </c-><c- p>{</c-> <c- k>quotes</c-><c- p>:</c-> <c- s>"\201C"</c-> <c- s>"\201D"</c-> <c- s>"\2018"</c-> <c- s>"\2019"</c-> <c- p>}</c-> </pre> <p>The quotation marks are shown here in a form that most people will be able to type. If you can type them directly, they will look like this:</p> <pre class="highlight"><c- f>:lang(fr) > * </c-><c- p>{</c-> <c- k>quotes</c-><c- p>:</c-> <c- s>"« "</c-> <c- s>" »"</c-> <c- s>"‹ "</c-> <c- s>" ›"</c-> <c- p>}</c-> <c- f>:lang(en) > * </c-><c- p>{</c-> <c- k>quotes</c-><c- p>:</c-> <c- s>"“"</c-> <c- s>"”"</c-> <c- s>"‘"</c-> <c- s>"’"</c-> <c- p>}</c-> </pre> </div> <div class="example" id="example-eb11c28e"> <a class="self-link" href="#example-eb11c28e"></a> For example, applying the following style sheet: <pre class="highlight"><c- c>/* Specify pairs of quotes for two levels in two languages */</c-> <c- f>:lang(en) > q </c-><c- p>{</c-> <c- k>quotes</c-><c- p>:</c-> <c- s>'"'</c-> <c- s>'"'</c-> <c- s>"'"</c-> <c- s>"'"</c-> <c- p>}</c-> <c- f>:lang(no) > q </c-><c- p>{</c-> <c- k>quotes</c-><c- p>:</c-> <c- s>"«"</c-> <c- s>"»"</c-> <c- s>"’"</c-> <c- s>"’"</c-> <c- p>}</c-> <c- c>/* Insert quotes before and after Q element content */</c-> <c- f>q::before </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> open-quote <c- p>}</c-> <c- f>q::after </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> close-quote <c- p>}</c-> </pre> <p>to the following HTML fragment:</p> <pre class="html-example highlight"><html lang="en"> <head> <title>Quotes</title> </head> <body> <p><q>Quote me!</q></p> </body> </html> </pre> <p>would allow a user agent to produce:</p> <pre class="highlight">"Quote me!" </pre> <p>while this HTML fragment:</p> <pre class="html-example highlight"><html lang="no"> <head> <title>Quotes</title> </head> <body> <p><q>Trøndere gråter når <q>Vinsjan på kaia</q> blir deklamert.</q></p> </body> </html> </pre> <p>would produce:</p> <pre class="highlight">«Trøndere gråter når ’Vinsjan på kaia’ blir deklamert.» </pre> </div> <h3 class="heading settled" data-level="2.5" id="leaders"><span class="secno">2.5. </span><span class="content"> Leaders</span><a class="self-link" href="#leaders"></a></h3> <p>A leader, sometimes known as a tab leader or a dot leader, is a repeating pattern used to visually connect content across horizontal spaces. They are most commonly used in tables of contents, between titles and page numbers. The <span class="css">leader()</span> function, as a value for the content property, is used to create leaders in CSS. This function takes a string (the leader string), which describes the repeating pattern for the leader.</p> <h4 class="heading settled" data-level="2.5.1" id="leader-function"><span class="secno">2.5.1. </span><span class="content"> The <span class="css">leader()</span> function</span><a class="self-link" href="#leader-function"></a></h4> <dl> <dt><dfn class="css" data-dfn-for="content, <content-list>" data-dfn-type="function" data-export data-lt="leader()" id="funcdef-content-leader">leader( <a class="production css" data-link-type="type" href="#typedef-leader-type" id="ref-for-typedef-leader-type"><leader-type></a> )<a class="self-link" href="#funcdef-content-leader"></a></dfn> <dd> Inserts a leader. See the section on <a href="#leaders">leaders</a> for more information. </dl> <pre class="prod highlight"><dfn data-dfn-type="function" data-export id="funcdef-leader">leader()<a class="self-link" href="#funcdef-leader"></a></dfn> = leader( <a class="production" data-link-type="type" href="#typedef-leader-type" id="ref-for-typedef-leader-type①"><leader-type></a> ) <dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-leader-type"><a class="production" data-link-type="type" href="#typedef-leader-type" id="ref-for-typedef-leader-type②"><leader-type></a></dfn> = dotted <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①⑤">|</a> solid <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①⑥">|</a> space <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①⑦">|</a> <a class="production" data-link-type="type" href="https://www.w3.org/TR/css3-values/#string-value" id="ref-for-string-value⑧"><string></a> </pre> <p>Three keywords are shorthand values for common strings:</p> <dl> <dt><dfn class="css" data-dfn-for="leader()" data-dfn-type="value" data-export id="valdef-leader-dotted">dotted<a class="self-link" href="#valdef-leader-dotted"></a></dfn> <dd>Equivalent to <span class="css">leader(".")</span> <dt><dfn class="css" data-dfn-for="leader()" data-dfn-type="value" data-export id="valdef-leader-solid">solid<a class="self-link" href="#valdef-leader-solid"></a></dfn> <dd>Equivalent to <span class="css">leader("_")</span> <dt><dfn class="css" data-dfn-for="leader()" data-dfn-type="value" data-export id="valdef-leader-space">space<a class="self-link" href="#valdef-leader-space"></a></dfn> <dd>Equivalent to <span class="css">leader(" ")</span> <dt><dfn class="css" data-dfn-for="leader()" data-dfn-type="value" data-export id="valdef-leader-string"><a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-values/#string-value" id="ref-for-string-value⑨"><string></a><a class="self-link" href="#valdef-leader-string"></a></dfn> <dd> Issue: Define this. </dl> <div class="example" id="example-e0047436"> <a class="self-link" href="#example-e0047436"></a> <pre class="highlight"><c- f>ol.toc a::after </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> <c- nf>leader</c-><c- p>(</c-><c- s>'.'</c-><c- p>)</c-> <c- nf>target-counter</c-><c- p>(</c-><c- nf>attr</c-><c- p>(</c->href<c- p>),</c-> page<c- p>);</c-> <c- p>}</c-> <h1>Table of Contents</h1> <ol class="toc"> <li><a href="#chapter1">Loomings</a></li> <li><a href="#chapter2">The Carpet-Bag</a></li> <li><a href="#chapter3">The Spouter-Inn</a></li> </ol> </pre> <p>This might result in:</p> <pre class="highlight">Table of Contents 1. Loomings.....................1 2. The Carpet-Bag...............9 3. The Spouter-Inn.............13 </pre> </div> <p class="issue" id="issue-2f5c8d3f"><a class="self-link" href="#issue-2f5c8d3f"></a> Do leaders depend on the assumption that the content after the leader is right-aligned (end-aligned)?</p> <h4 class="heading settled" data-level="2.5.2" id="leader-rules"><span class="secno">2.5.2. </span><span class="content"> Rendering leaders</span><a class="self-link" href="#leader-rules"></a></h4> <p>Consider a line which contains the content before the leader (the “before content”), the leader, and the content after the leader (the “after content”). Leaders obey the following rules:</p> <ol> <li data-md> <p>The leader string must appear in full at least once.</p> <li data-md> <p>The leader should be as long as possible</p> <li data-md> <p>Visible characters in leaders should vertically align with each other when possible.</p> <li data-md> <p>Line break characters in the leader string must be ignored.</p> <li data-md> <p>White space in the leader string follows normal CSS rules.</p> <li data-md> <p>A leader only appears between the start content and the end content.</p> <li data-md> <p>A leader only appears on a single line, even if the before content and after content are on different lines.</p> <li data-md> <p>A leader can’t be the only thing on a line.</p> </ol> <h4 class="heading settled" data-level="2.5.3" id="leader-alignment"><span class="secno">2.5.3. </span><span class="content"> Procedure for rendering leaders</span><a class="self-link" href="#leader-alignment"></a></h4> <ol> <li data-md> <p>Lay out the <var>before content</var>, until reaching the line where the <var>before content</var> ends.</p> <pre class="highlight">BBBBBBBBBB BBB </pre> <li data-md> <p>The leader string consists of one or more glyphs, and is thus an inline box. A leader is a row of these boxes, drawn from the end edge to the start edge, where only those boxes not overlaid by the before or after content. On this line, draw the leader string, starting from the end edge, repeating as many times as possible until reaching the start edge.</p> <pre class="highlight">BBBBBBBBBB .......... </pre> <li data-md> <p>Draw the before and after content on top of the leader. If any part of the <var>before content</var> or <var>after content</var> overlaps a glyph in a leader string box, that glyph is not displayed.</p> <pre class="highlight">BBBBBBBBBB BBB....AAA </pre> <li data-md> <p>If one full copy of the leader string is not visible:</p> <pre class="highlight">BBBBBBB BBBBBBA </pre> <p>Insert a line break after the <var>before content</var>, draw the leader on the next line, and draw the <var>after content</var> on top, and hide any leader strings that are not fully displayed.</p> <pre class="highlight">BBBBBBB BBBBBB ......A </pre> </ol> <p class="issue" id="issue-449754e4"><a class="self-link" href="#issue-449754e4"></a> what to do if <var>after content</var> is wider than the line box?</p> <p class="issue" id="issue-bb18b3e4"><a class="self-link" href="#issue-bb18b3e4"></a> Leaders don’t quite work in table layouts. How can we fix this?</p> <figure> <img alt="drawing leaders" src="images/leader.001.jpg" width="480"> <figcaption>Procedure for drawing leaders</figcaption> </figure> <figure> <img alt="drawing leaders" src="images/leader.002.jpg" width="480"> <figcaption>Procedure for drawing leaders when the content doesn’t fit on a single line</figcaption> </figure> <h3 class="heading settled" data-level="2.6" id="cross-references"><span class="secno">2.6. </span><span class="content"> Cross references and the target-* functions</span><a class="self-link" href="#cross-references"></a></h3> <p>Many documents contain internal references:</p> <div class="example" id="example-33585682"> <a class="self-link" href="#example-33585682"></a> <ul> <li data-md> <p>See chapter 7</p> <li data-md> <p>in section 4.1</p> <li data-md> <p>on page 23</p> </ul> </div> <p>Three new values for the content property are used to automatically create these types of cross-references: <a class="css" data-link-type="maybe" href="#funcdef-target-counter" id="ref-for-funcdef-target-counter">target-counter()</a>, <a class="css" data-link-type="maybe" href="#funcdef-target-counters" id="ref-for-funcdef-target-counters">target-counters()</a>, and <a class="css" data-link-type="maybe" href="#target-text-function" id="ref-for-target-text-function">target-text()</a>. Each of these displays information obtained from the target end of a link.</p> <pre class="prod highlight"><dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-target"><a class="production" data-link-type="type" href="#typedef-target" id="ref-for-typedef-target①"><target></a></dfn> = <a class="production" data-link-type="function" href="#funcdef-target-counter" id="ref-for-funcdef-target-counter①"><target-counter()></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①⑧">|</a> <a class="production" data-link-type="function" href="#funcdef-target-counters" id="ref-for-funcdef-target-counters①"><target-counters()></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①⑨">|</a> <a class="production" data-link-type="function" href="#target-text-function" id="ref-for-target-text-function①"><target-text()></a> </pre> <p>See sections below for details on each of these.</p> <h4 class="heading settled" data-level="2.6.1" id="target-counter"><span class="secno">2.6.1. </span><span class="content"> The <a class="css" data-link-type="maybe" href="#funcdef-target-counter" id="ref-for-funcdef-target-counter②">target-counter()</a> function</span><a class="self-link" href="#target-counter"></a></h4> <pre class="prod highlight"><dfn class="dfn-paneled" data-dfn-type="function" data-export id="funcdef-target-counter">target-counter()</dfn> = target-counter( [ <a class="production" data-link-type="type" href="https://www.w3.org/TR/css3-values/#string-value" id="ref-for-string-value①⓪"><string></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one②⓪">|</a> <a class="production" data-link-type="type" href="https://www.w3.org/TR/css3-values/#url-value" id="ref-for-url-value"><url></a> ] <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-comma" id="ref-for-comb-comma">,</a> <a class="production" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#identifier-value" id="ref-for-identifier-value"><custom-ident></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-comma" id="ref-for-comb-comma①">,</a> <a class="production" data-link-type="type" href="https://www.w3.org/TR/css-counter-styles-3/#typedef-counter-style" id="ref-for-typedef-counter-style" title="Expands to: simp-chinese-formal | simp-chinese-informal | japanese-informal | trad-chinese-formal | cjk-ideographic | japanese-formal | trad-chinese-informal"><counter-style></a><a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-opt" id="ref-for-mult-opt①">?</a> ) </pre> <p>The <a class="css" data-link-type="maybe" href="#funcdef-target-counter" id="ref-for-funcdef-target-counter③">target-counter()</a> function retrieves the value of the innermost counter with a given name. The required arguments are the url of the target and the name of the counter. An optional counter-style argument can be used to format the result.</p> <p>These functions only take a fragment URL which points to a location in the current document. If there’s no fragment, if the ID referenced isn’t there, or if the URL points to an outside document, the user agent must treat that as an error.</p> <p class="issue" id="issue-7443dd19"><a class="self-link" href="#issue-7443dd19"></a> what should error handling be?</p> <p class="issue" id="issue-2b2bd98b"><a class="self-link" href="#issue-2b2bd98b"></a> restrict syntactically to local references for now.</p> <div class="example" id="example-a3b9f868"> <a class="self-link" href="#example-a3b9f868"></a> HTML: <pre class="highlight">…which will be discussed on page <a href="#chapter4_sec2"></a>. </pre> <p>CSS:</p> <pre class="highlight"><c- f>a::after </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> <c- nf>target-counter</c-><c- p>(</c-><c- nf>attr</c-><c- p>(</c->href url<c- p>),</c-> page<c- p>)</c-> <c- p>}</c-> </pre> <p>Result:</p> <pre class="highlight">…which will be discussed on page 137. </pre> </div> <div class="example" id="example-61dcfb19"> <a class="self-link" href="#example-61dcfb19"></a> Page numbers in tables of contents can be generated automatically: <p>HTML:</p> <pre class="highlight"><nav> <ol> <li class="frontmatter"><a href="#pref_01">Preface</a></li> <li class="frontmatter"><a href="#intr_01">Introduction</a></li> <li class="bodymatter"><a href="#chap_01">Chapter One</a></li> </ol> </nav> </pre> <p>CSS:</p> <pre class="highlight"><c- f>.frontmatter a::after </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> <c- nf>leader</c-><c- p>(</c-><c- s>'.'</c-><c- p>)</c-> <c- nf>target-counter</c-><c- p>(</c-><c- nf>attr</c-><c- p>(</c->href url<c- p>),</c-> page<c- p>,</c-> lower-roman<c- p>)</c-> <c- p>}</c-> <c- f>.bodymatter a::after </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> <c- nf>leader</c-><c- p>(</c-><c- s>'.'</c-><c- p>)</c-> <c- nf>target-counter</c-><c- p>(</c-><c- nf>attr</c-><c- p>(</c->href url<c- p>),</c-> page<c- p>,</c-> decimal<c- p>)</c-> <c- p>}</c-> </pre> <p>Result:</p> <pre class="highlight">Preface.............vii Introduction.........xi Chapter One...........1 </pre> </div> <h4 class="heading settled" data-level="2.6.2" id="target-counters"><span class="secno">2.6.2. </span><span class="content"> The <a class="css" data-link-type="maybe" href="#funcdef-target-counters" id="ref-for-funcdef-target-counters②">target-counters()</a> function </span><a class="self-link" href="#target-counters"></a></h4> <p>This functions fetches the value of all counters of a given name from the end of a link, and formats them by inserting a given string between the value of each nested counter.</p> <pre class="prod highlight"><dfn class="dfn-paneled" data-dfn-type="function" data-export id="funcdef-target-counters">target-counters()</dfn> = target-counters( [ <a class="production" data-link-type="type" href="https://www.w3.org/TR/css3-values/#string-value" id="ref-for-string-value①①"><string></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one②①">|</a> <a class="production" data-link-type="type" href="https://www.w3.org/TR/css3-values/#url-value" id="ref-for-url-value①"><url></a> ] <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-comma" id="ref-for-comb-comma②">,</a> <a class="production" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#identifier-value" id="ref-for-identifier-value①"><custom-ident></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-comma" id="ref-for-comb-comma③">,</a> <a class="production" data-link-type="type" href="https://www.w3.org/TR/css3-values/#string-value" id="ref-for-string-value①②"><string></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-comma" id="ref-for-comb-comma④">,</a> <a class="production" data-link-type="type" href="https://www.w3.org/TR/css-counter-styles-3/#typedef-counter-style" id="ref-for-typedef-counter-style①" title="Expands to: simp-chinese-formal | simp-chinese-informal | japanese-informal | trad-chinese-formal | cjk-ideographic | japanese-formal | trad-chinese-informal"><counter-style></a><a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-opt" id="ref-for-mult-opt②">?</a> ) </pre> <div class="example" id="example-00974551"> <a class="self-link" href="#example-00974551"></a> <pre class="highlight">I have not found a compelling example for target-counters() yet. </pre> <p class="issue" id="issue-6e7203db"><a class="self-link" href="#issue-6e7203db"></a> found a compelling example, in CSS specs. Do something.</p> </div> <h4 class="heading settled" data-level="2.6.3" id="target-text"><span class="secno">2.6.3. </span><span class="content"> The <a class="css" data-link-type="maybe" href="#target-text-function" id="ref-for-target-text-function②">target-text()</a> function</span><a class="self-link" href="#target-text"></a></h4> <p>The <a class="css" data-link-type="maybe" href="#target-text-function" id="ref-for-target-text-function③">target-text()</a> function retrieves the text value of the element referred to by the URL. An optional second argument specifies what content is retrieved, using the same values as the <a class="property" data-link-type="propdesc" href="#propdef-string-set" id="ref-for-propdef-string-set">string-set</a> property above.</p> <pre class="prod highlight"><dfn class="dfn-paneled" data-dfn-type="function" data-export id="target-text-function">target-text()</dfn> = target-text( [ <a class="production" data-link-type="type" href="https://www.w3.org/TR/css3-values/#string-value" id="ref-for-string-value①③"><string></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one②②">|</a> <a class="production" data-link-type="type" href="https://www.w3.org/TR/css3-values/#url-value" id="ref-for-url-value②"><url></a> ] <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-comma" id="ref-for-comb-comma⑤">,</a> [ content <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one②③">|</a> before <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one②④">|</a> after <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one②⑤">|</a> first-letter ]<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-opt" id="ref-for-mult-opt③">?</a> ) </pre> <p class="issue" id="issue-a82075c9"><a class="self-link" href="#issue-a82075c9"></a> A simpler syntax has been proposed by fantasai: <a href="https://lists.w3.org/Archives/Public/www-style/2012Feb/0745.html">https://lists.w3.org/Archives/Public/www-style/2012Feb/0745.html</a></p> <div class="example" id="example-d5ce9fa3"> <a class="self-link" href="#example-d5ce9fa3"></a> <pre class="highlight"><c- f>…which will be discussed <a href="#chapter_h1_1">later</a>.</c-> <c- f>a::after </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> <c- s>", in the chapter entitled "</c-> <c- nf>target-text</c-><c- p>(</c-><c- nf>attr</c-><c- p>(</c->href url<c- p>))</c-> <c- p>}</c-> </pre> <p>Result: …which will be discussed later, in the chapter entitled Loomings.</p> </div> <h3 class="heading settled" data-level="2.7" id="named-strings"><span class="secno">2.7. </span><span class="content"> Named strings</span><a class="self-link" href="#named-strings"></a></h3> <p>This section introduces <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="named string" data-noexport id="named-string">named strings</dfn>, which are the textual equivalent of counters and which have a distinct namespace from counters. Named strings follow the same nesting rules as counters. The <a class="property" data-link-type="propdesc" href="#propdef-string-set" id="ref-for-propdef-string-set①">string-set</a> property accepts values similar to the <a class="property" data-link-type="propdesc" href="#propdef-content" id="ref-for-propdef-content①④">content</a> property, including the extraction of the current value of counters.</p> <p>Named strings are a convenient way to pull metadata out of the document for insertion into headers and footers. In HTML, for example, META elements contained in the document HEAD can set the value of named strings. In conjunction with attribute selectors, this can be a powerful mechanism:</p> <div class="example" id="example-208227c0"> <a class="self-link" href="#example-208227c0"></a> <pre class="highlight"><c- f>meta[author] </c-><c- p>{</c-> <c- k>string-set</c-><c- p>:</c-> author <c- nf>attr</c-><c- p>(</c->author<c- p>);</c-> <c- p>}</c-> <c- f>head > title </c-><c- p>{</c-> <c- k>string-set</c-><c- p>:</c-> title contents<c- p>;</c-> <c- p>}</c-> <c- n>@page</c-><c- f>:left </c-><c- p>{</c-> <c- n>@top</c-> <c- p>{</c-> <c- k>text-align</c-><c- p>:</c-> left<c- p>;</c-> <c- k>vertical-align</c-><c- p>:</c-> middle<c- p>;</c-> <c- k>content</c-><c- p>:</c-> <c- nf>string</c-><c- p>(</c->title<c- p>);</c-> <c- p>}</c-> <c- p>}</c-> <c- n>@page</c-><c- f>:right </c-><c- p>{</c-> <c- n>@top</c-> <c- p>{</c-> <c- k>text-align</c-><c- p>:</c-> right<c- p>;</c-> <c- k>vertical-align</c-><c- p>:</c-> middle<c- p>;</c-> <c- k>content</c-><c- p>:</c-> <c- nf>string</c-><c- p>(</c->author<c- p>);</c-> <c- p>}</c-> <c- p>}</c-> </pre> </div> <h4 class="heading settled" data-level="2.7.1" id="string-set"><span class="secno">2.7.1. </span><span class="content"> The string-set property</span><a class="self-link" href="#string-set"></a></h4> <table class="def propdef" data-link-for-hint="string-set"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-string-set">string-set</dfn> <tr class="value"> <th><a href="https://drafts.csswg.org/css-values/#value-defs">Value:</a> <td class="prod">none <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one②⑥">|</a> [ <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#identifier-value" id="ref-for-identifier-value②"><custom-ident></a> <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-values/#string-value" id="ref-for-string-value①④"><string></a><a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-one-plus" id="ref-for-mult-one-plus③">+</a> ]<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-comma" id="ref-for-mult-comma">#</a> <tr> <th><a href="https://drafts.csswg.org/css-cascade/#initial-values">Initial:</a> <td>none <tr> <th>Applies to: <td>all elements, but not pseudo-elements <tr> <th><a href="https://drafts.csswg.org/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://drafts.csswg.org/css-values/#percentages">Percentages:</a> <td>N/A <tr> <th><a href="https://drafts.csswg.org/css-cascade/#computed">Computed value:</a> <td>the keyword <a class="css" data-link-type="maybe" href="#valdef-string-set-none" id="ref-for-valdef-string-set-none">none</a> or a list, each item an identifier paired with a list of string values <tr> <th>Canonical order: <td>per grammar <tr> <th><a href="https://drafts.csswg.org/web-animations/#animation-type">Animation type:</a> <td>discrete </table> <p class="all-media">User Agents are expected to support this property on all media, including non-visual ones.</p> <p>The <a class="property" data-link-type="propdesc" href="#propdef-string-set" id="ref-for-propdef-string-set②">string-set</a> property copies the text content of an element into a <span class="css">named string</span>, which functions as a variable. The text content of this named string can be retrieved using the <a class="css" data-link-type="maybe" href="#funcdef-string" id="ref-for-funcdef-string">string()</a> function. Since these variables may change on a given page, an optional second value for the <span class="css" id="ref-for-funcdef-string①">string()</span> function allows authors to choose which value on a page is used.</p> <dl> <dt><dfn class="dfn-paneled css" data-dfn-for="string-set" data-dfn-type="value" data-export id="valdef-string-set-none">none</dfn> <dd> The element does not set any named strings. <dt><code class="highlight">[ <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#identifier-value" id="ref-for-identifier-value③"><custom-ident></a> <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-values/#string-value" id="ref-for-string-value①⑤"><string></a>+ ]#</code> <dd> The element establishes one or more named strings, corresponding to each comma-separated entry in the list. <p>For each entry, the <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#identifier-value" id="ref-for-identifier-value④"><custom-ident></a> gives the name of the named string. It’s followed by one or more <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-values/#string-value" id="ref-for-string-value①⑥"><string></a> values, which are concatenated together to form the value of the named string.</p> </dl> <p>If an element has <a data-link-type="dfn" href="https://www.w3.org/TR/css-contain-1/#style-containment" id="ref-for-style-containment">style containment</a>, the <a class="property" data-link-type="propdesc" href="#propdef-string-set" id="ref-for-propdef-string-set③">string-set</a> property must have no effects on descendants of that element.</p> <div class="example" id="example-ebda2d09"> <a class="self-link" href="#example-ebda2d09"></a> The following example captures the contents of H1 elements, which represent chapter names in this hypothetical document. <pre class="highlight"><c- f>H1 </c-><c- p>{</c-> <c- k>string-set</c-><c- p>:</c-> chapter contents<c- p>;</c-> <c- p>}</c-></pre> <p>When an H1 element is encountered, the <span class="css">chapter</span> string is set to the element’s textual contents, and the previous value of <span class="css">chapter</span>, if any, is overwritten.</p> </div> <h4 class="heading settled" data-level="2.7.2" id="string-function"><span class="secno">2.7.2. </span><span class="content"> The <a class="css" data-link-type="maybe" href="#funcdef-string" id="ref-for-funcdef-string②">string()</a> function</span><a class="self-link" href="#string-function"></a></h4> <pre class="prod highlight"><dfn class="dfn-paneled" data-dfn-type="function" data-export id="funcdef-string">string()</dfn> = string( <a class="production" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#identifier-value" id="ref-for-identifier-value⑤"><custom-ident></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-comma" id="ref-for-comb-comma⑥">,</a> [ first <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one②⑦">|</a> start <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one②⑧">|</a> last <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one②⑨">|</a> first-except ]<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-opt" id="ref-for-mult-opt④">?</a> ) </pre> <p>The <a class="css" data-link-type="maybe" href="#funcdef-string" id="ref-for-funcdef-string③">string()</a> function is used to copy the value of a named string to the document, via the <a class="property" data-link-type="propdesc" href="#propdef-content" id="ref-for-propdef-content①⑤">content</a> property. This function requires one argument, the name of the named string. Since the value of a named string may change several times on a page (as multiple elements defining the string can appear) an optional second argument indicates which value of the named string should be used.</p> <p>The second argument of the <a class="css" data-link-type="maybe" href="#funcdef-string" id="ref-for-funcdef-string④">string()</a> function is one of the following keywords:</p> <dl> <dt><dfn class="dfn-paneled css" data-dfn-for="string()" data-dfn-type="value" data-export id="valdef-string-first">first</dfn> <dd> The value of the first assignment on the page is used. If there is no assignment on the page, the <a data-link-type="dfn" href="#entry-value" id="ref-for-entry-value">entry value</a> is used. If no second argument is provided, this is the default value. <dt><dfn class="css" data-dfn-for="string()" data-dfn-type="value" data-export id="valdef-string-start">start<a class="self-link" href="#valdef-string-start"></a></dfn> <dd> If the element is the first element on the page, the value of the first assignment is used. Otherwise the <a data-link-type="dfn" href="#entry-value" id="ref-for-entry-value①">entry value</a> is used. The <span id="ref-for-entry-value②">entry value</span> may be empty if the <a data-link-type="dfn" href="#named-string" id="ref-for-named-string">named string</a> hasn’t yet appeared. <dt><dfn class="css" data-dfn-for="string()" data-dfn-type="value" data-export id="valdef-string-last">last<a class="self-link" href="#valdef-string-last"></a></dfn> <dd> The <a data-link-type="dfn" href="#exit-value" id="ref-for-exit-value">exit value</a> of the named string is used. <dt><dfn class="css" data-dfn-for="string()" data-dfn-type="value" data-export id="valdef-string-first-except">first-except<a class="self-link" href="#valdef-string-first-except"></a></dfn> <dd> This is identical to <a class="css" data-link-type="maybe" href="#valdef-string-first" id="ref-for-valdef-string-first">first</a>, except that the empty string is used on the page where the value is assigned. <p class="issue" id="issue-c24bc3d7"><a class="self-link" href="#issue-c24bc3d7"></a> we may need to kill the entire content string. Is this necessary?</p> </dl> <p>The content values of named strings are assigned at the point when the content box of the element is first created (or would have been created if the element’s display value is none). The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="entry-value">entry value</dfn> for a page is the assignment in effect at the end of the previous page. The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="exit-value">exit value</dfn> for a page is the assignment in effect at the end of the current page.</p> <div class="example" id="example-23e3824c"> <a class="self-link" href="#example-23e3824c"></a> CSS: <pre class="highlight"><c- n>@page</c-> <c- p>{</c-> <c- k>size</c-><c- p>:</c-> <c- m>15</c-><c- l>cm</c-> <c- m>10</c-><c- l>cm</c-><c- p>;</c-> <c- k>margin</c-><c- p>:</c-> <c- m>1.5</c-><c- l>cm</c-><c- p>;</c-> <c- n>@top-left</c-> <c- p>{</c-> <c- k>content</c-><c- p>:</c-> <c- s>"first: "</c-> <c- nf>string</c-><c- p>(</c->heading<c- p>,</c-> first<c- p>);</c-> <c- p>}</c-> <c- n>@top-center</c-> <c- p>{</c-> <c- k>content</c-><c- p>:</c-> <c- s>"start: "</c-> <c- nf>string</c-><c- p>(</c->heading<c- p>,</c-> start<c- p>);</c-> <c- p>}</c-> <c- n>@top-right</c-> <c- p>{</c-> <c- k>content</c-><c- p>:</c-> <c- s>"last: "</c-> <c- nf>string</c-><c- p>(</c->heading<c- p>,</c-> last<c- p>);</c-> <c- p>}</c-> <c- p>}</c-> <c- f>h2 </c-><c- p>{</c-> <c- k>string-set</c-><c- p>:</c-> heading <c- nf>content</c-><c- p>()</c-> <c- p>}</c-> </pre> <p>The following figures show the first, start, and last assignments of the “heading” string on various pages.</p> <figure> <img alt src="images/using-strings-1.jpg" width="480"> <figcaption>The <span class="css">start</span> value is empty, as the string had not yet been set at the start of the page.</figcaption> </figure> <figure> <img alt src="images/using-strings-2.jpg" width="480"> <figcaption>Since the page starts with an h2, the <span class="css">start</span> value is the value of that head.</figcaption> </figure> <figure> <img alt src="images/using-strings-3.jpg" width="480"> <figcaption>Since there’s not an h2 at the top of this page, the <span class="css">start</span> value is the <a data-link-type="dfn" href="#exit-value" id="ref-for-exit-value①">exit value</a> of the previous page.</figcaption> </figure> </div> <h4 class="heading settled" data-level="2.7.3" id="content-function"><span class="secno">2.7.3. </span><span class="content"> The <a class="css" data-link-type="maybe" href="#funcdef-content" id="ref-for-funcdef-content①">content()</a> function</span><a class="self-link" href="#content-function"></a></h4> <pre class="prod highlight"><dfn class="dfn-paneled" data-dfn-type="function" data-export id="funcdef-content">content()</dfn> = content( [ text <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one③⓪">|</a> before <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one③①">|</a> after <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one③②">|</a> first-letter <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one③③">|</a> marker ]<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-opt" id="ref-for-mult-opt⑤">?</a> ) </pre> <dl> <dt><dfn class="dfn-paneled css" data-dfn-for="content()" data-dfn-type="value" data-export id="valdef-content-text">text</dfn> <dd>The string value of the element. If no value is specified in <a class="css" data-link-type="maybe" href="#funcdef-content" id="ref-for-funcdef-content②">content()</a>, it acts as if <a class="css" data-link-type="maybe" href="#valdef-content-text" id="ref-for-valdef-content-text">text</a> were specified. <dt><dfn class="css" data-dfn-for="content()" data-dfn-type="value" data-export id="valdef-content-before">before<a class="self-link" href="#valdef-content-before"></a></dfn> <dd>The string value of the <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-pseudo-4/#selectordef-before" id="ref-for-selectordef-before②">::before</a> pseudo-element. <dt><dfn class="css" data-dfn-for="content()" data-dfn-type="value" data-export id="valdef-content-after">after<a class="self-link" href="#valdef-content-after"></a></dfn> <dd>The string value of the <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-pseudo-4/#selectordef-after" id="ref-for-selectordef-after②">::after</a> pseudo-element. <dt><dfn class="css" data-dfn-for="content()" data-dfn-type="value" data-export id="valdef-content-first-letter">first-letter<a class="self-link" href="#valdef-content-first-letter"></a></dfn> <dd>The first letter of the element, as defined for the <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-pseudo-4/#selectordef-first-letter" id="ref-for-selectordef-first-letter">::first-letter</a> pseudo-element <dt><dfn class="css" data-dfn-for="content()" data-dfn-type="value" data-export id="valdef-content-marker">marker<a class="self-link" href="#valdef-content-marker"></a></dfn> <dd>The string value of the <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-pseudo-4/#selectordef-marker" id="ref-for-selectordef-marker②">::marker</a> pseudo-element. </dl> <div class="example" id="example-e698ead2"> <a class="self-link" href="#example-e698ead2"></a> HTML: <pre class="highlight"><h1>Loomings</h1> </pre> <p>CSS:</p> <pre class="highlight"><c- f>h1::before </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> <c- s>'Chapter '</c-> <c- nf>counter</c-><c- p>(</c->chapter<c- p>);</c-> <c- p>}</c-> <c- f>h1 </c-><c- p>{</c-> <c- k>string-set</c-><c- p>:</c-> header <c- nf>content</c-><c- p>(</c->before<c- p>)</c-> <c- s>':'</c-> <c- nf>content</c-><c- p>(</c->text<c- p>);</c-> <c- p>}</c-> <c- f>h1::after </c-><c- p>{</c-> <c- k>content</c-><c- p>:</c-> <c- s>'.'</c-><c- p>;</c-> <c- p>}</c-> </pre> <p>The value of the named string “header” will be “Chapter 1: Loomings”.</p> </div> <div class="example" id="example-ba54cbec"> <a class="self-link" href="#example-ba54cbec"></a> HTML: <pre class="highlight"><section title="Loomings"> </pre> <p>CSS:</p> <pre class="highlight"><c- f>section </c-><c- p>{</c-> <c- k>string-set</c-><c- p>:</c-> header <c- nf>attr</c-><c- p>(</c->title<c- p>)</c-> <c- p>}</c-> </pre> <p>The value of the “header” string will be “Loomings”.</p> </div> <h2 class="heading settled" data-level="3" id="counters"><span class="secno">3. </span><span class="content"> Automatic counters and numbering: the <a class="property" data-link-type="propdesc" href="https://www.w3.org/TR/css-lists-3/#propdef-counter-increment" id="ref-for-propdef-counter-increment">counter-increment</a> and <a class="property" data-link-type="propdesc" href="https://www.w3.org/TR/css-lists-3/#propdef-counter-reset" id="ref-for-propdef-counter-reset">counter-reset</a> properties (moved)</span><a class="self-link" href="#counters"></a></h2> <p class="issue" id="issue-227d7dec"><a class="self-link" href="#issue-227d7dec"></a> Now described in <a data-link-type="biblio" href="#biblio-css3list">[CSS3LIST]</a></p> <p class="issue" id="issue-0161c10e"><a class="self-link" href="#issue-0161c10e"></a> Should this move back to CSS Content?</p> <h2 class="heading settled" data-level="4" id="bookmark-generation"><span class="secno">4. </span><span class="content"> Bookmarks</span><a class="self-link" href="#bookmark-generation"></a></h2> <p>Some document formats, most notably PDF, allow the use of <dfn data-dfn-type="dfn" data-noexport id="bookmarks">bookmarks<a class="self-link" href="#bookmarks"></a></dfn> as an aid to navigation. Bookmarks provide a list of links to document elements, as well as text to label the links and a level value. A bookmark has three properties: <a class="property" data-link-type="propdesc" href="#propdef-bookmark-level" id="ref-for-propdef-bookmark-level">bookmark-level</a>, <a class="property" data-link-type="propdesc" href="#propdef-bookmark-label" id="ref-for-propdef-bookmark-label">bookmark-label</a>, and <a class="property" data-link-type="propdesc" href="#propdef-bookmark-state" id="ref-for-propdef-bookmark-state">bookmark-state</a>.</p> <p>When a user activates a bookmark, the user agent must bring that reference point to the user’s attention, exactly as if navigating to that element by fragment URL. <span class="note">This will also trigger matching the <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/selectors4/#target-pseudo" id="ref-for-target-pseudo">:target</a> pseudo-class.</span></p> <p>If an element has <a data-link-type="dfn" href="https://www.w3.org/TR/css-contain-1/#style-containment" id="ref-for-style-containment①">style containment</a>, the <a class="property" data-link-type="propdesc" href="#propdef-bookmark-level" id="ref-for-propdef-bookmark-level①">bookmark-level</a>, <a class="property" data-link-type="propdesc" href="#propdef-bookmark-label" id="ref-for-propdef-bookmark-label①">bookmark-label</a>, and <a class="property" data-link-type="propdesc" href="#propdef-bookmark-state" id="ref-for-propdef-bookmark-state①">bookmark-state</a> properties must have no effect on descendants of the element.</p> <h3 class="heading settled" data-level="4.1" id="bookmark-level"><span class="secno">4.1. </span><span class="content"> bookmark-level </span><a class="self-link" href="#bookmark-level"></a></h3> <p>The <a class="property" data-link-type="propdesc" href="#propdef-bookmark-level" id="ref-for-propdef-bookmark-level②">bookmark-level</a> property determines if a bookmark is created, and at what level. If this property is absent, or has value <a class="css" data-link-type="maybe" href="#valdef-bookmark-level-none" id="ref-for-valdef-bookmark-level-none">none</a>, no bookmark should be generated, regardless of the values of <a class="property" data-link-type="propdesc" href="#propdef-bookmark-label" id="ref-for-propdef-bookmark-label②">bookmark-label</a> or <a class="property" data-link-type="propdesc" href="#propdef-bookmark-state" id="ref-for-propdef-bookmark-state②">bookmark-state</a>.</p> <table class="def propdef" data-link-for-hint="bookmark-level"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-bookmark-level">bookmark-level</dfn> <tr class="value"> <th><a href="https://drafts.csswg.org/css-values/#value-defs">Value:</a> <td class="prod">none <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one③④">|</a> <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-values/#integer-value" id="ref-for-integer-value"><integer></a> <tr> <th><a href="https://drafts.csswg.org/css-cascade/#initial-values">Initial:</a> <td>none <tr> <th>Applies to: <td><a href="https://drafts.csswg.org/css-pseudo/#generated-content" title="Includes ::before and ::after pseudo-elements.">all elements</a> <tr> <th><a href="https://drafts.csswg.org/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://drafts.csswg.org/css-values/#percentages">Percentages:</a> <td>N/A <tr> <th><a href="https://drafts.csswg.org/css-cascade/#computed">Computed value:</a> <td>the keyword <a class="css" data-link-type="maybe" href="#valdef-bookmark-level-none" id="ref-for-valdef-bookmark-level-none①">none</a> or the specified integer <tr> <th>Canonical order: <td>per grammar <tr> <th><a href="https://drafts.csswg.org/web-animations/#animation-type">Animation type:</a> <td>by computed value type </table> <dl> <dt><dfn class="css" data-dfn-for="bookmark-level" data-dfn-type="value" data-export id="valdef-bookmark-level-integer"><a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-values/#integer-value" id="ref-for-integer-value①"><integer></a><a class="self-link" href="#valdef-bookmark-level-integer"></a></dfn> <dd>defines the level of the bookmark, with the top level being 1 (negative and zero values are invalid). <dt><dfn class="dfn-paneled css" data-dfn-for="bookmark-level" data-dfn-type="value" data-export id="valdef-bookmark-level-none">none</dfn> <dd>no bookmark is generated. </dl> <div class="example" id="example-dd8b2d49"> <a class="self-link" href="#example-dd8b2d49"></a> <pre class="highlight"><c- f>section h1 </c-><c- p>{</c-> <c- k>bookmark-level</c-><c- p>:</c-> <c- m>1</c-><c- p>;</c-> <c- p>}</c-> <c- f>section section h1 </c-><c- p>{</c-> <c- k>bookmark-level</c-><c- p>:</c-> <c- m>2</c-><c- p>;</c-> <c- p>}</c-> <c- f>section section section h1 </c-><c- p>{</c-> <c- k>bookmark-level</c-><c- p>:</c-> <c- m>3</c-><c- p>;</c-> <c- p>}</c-> </pre> </div> <p class="note" role="note"><span>Note:</span> Bookmarks do not need to create a strict hierarchy of levels.</p> <p class="issue" id="issue-de0f5f60"><a class="self-link" href="#issue-de0f5f60"></a> Should a bookmark be created for elements with <code class="highlight">display: none</code>?</p> <h3 class="heading settled" data-level="4.2" id="bookmark-label"><span class="secno">4.2. </span><span class="content"> bookmark-label</span><a class="self-link" href="#bookmark-label"></a></h3> <table class="def propdef" data-link-for-hint="bookmark-label"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-bookmark-label">bookmark-label</dfn> <tr class="value"> <th><a href="https://drafts.csswg.org/css-values/#value-defs">Value:</a> <td class="prod"><a class="production css" data-link-type="type" href="#typedef-content-content-list" id="ref-for-typedef-content-content-list⑥" title="Expands to: <string> | close-quote | <image> | leader() | no-close-quote | no-open-quote | open-quote | contents"><content-list></a> <tr> <th><a href="https://drafts.csswg.org/css-cascade/#initial-values">Initial:</a> <td>content(text) <tr> <th>Applies to: <td><a href="https://drafts.csswg.org/css-pseudo/#generated-content" title="Includes ::before and ::after pseudo-elements.">all elements</a> <tr> <th><a href="https://drafts.csswg.org/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://drafts.csswg.org/css-values/#percentages">Percentages:</a> <td>N/A <tr> <th><a href="https://drafts.csswg.org/css-cascade/#computed">Computed value:</a> <td>specified value <tr> <th>Canonical order: <td>per grammar <tr> <th><a href="https://drafts.csswg.org/web-animations/#animation-type">Animation type:</a> <td>discrete </table> <dl> <dt><dfn class="css" data-dfn-for="bookmark-label" data-dfn-type="value" data-export id="valdef-bookmark-label-content-list"><a class="production css" data-link-type="type" href="#typedef-content-content-list" id="ref-for-typedef-content-content-list⑦" title="Expands to: <string> | close-quote | <image> | leader() | no-close-quote | no-open-quote | open-quote | contents"><content-list></a><a class="self-link" href="#valdef-bookmark-label-content-list"></a></dfn> <dd><a class="production css" data-link-type="type" href="#typedef-content-content-list" id="ref-for-typedef-content-content-list⑧" title="Expands to: <string> | close-quote | <image> | leader() | no-close-quote | no-open-quote | open-quote | contents"><content-list></a> is defined above, in the section on the <a class="property" data-link-type="propdesc" href="#propdef-string-set" id="ref-for-propdef-string-set④">string-set</a> property. The value of <span class="production" id="ref-for-typedef-content-content-list⑨" title="Expands to: <string> | close-quote | <image> | leader() | no-close-quote | no-open-quote | open-quote | contents"><content-list></span> becomes the text content of the bookmark label. </dl> <div class="example" id="example-273659aa"> <a class="self-link" href="#example-273659aa"></a> HTML: <pre class="highlight"><h1>Loomings</h1> </pre> <p>CSS:</p> <pre class="highlight"><c- f>h1 </c-><c- p>{</c-> <c- k>bookmark-label</c-><c- p>:</c-> <c- nf>content</c-><c- p>(</c->text<c- p>);</c-> <c- k>bookmark-level</c-><c- p>:</c-> <c- m>1</c-><c- p>;</c-> <c- p>}</c-> </pre> <p>The bookmark label will be “Loomings”.</p> </div> <h3 class="heading settled" data-level="4.3" id="bookmark-state"><span class="secno">4.3. </span><span class="content"> bookmark-state</span><a class="self-link" href="#bookmark-state"></a></h3> <p>The <a class="property" data-link-type="propdesc" href="#propdef-bookmark-state" id="ref-for-propdef-bookmark-state③">bookmark-state</a> may be open or closed. The user must be able to toggle the bookmark state.</p> <table class="def propdef" data-link-for-hint="bookmark-state"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-bookmark-state">bookmark-state</dfn> <tr class="value"> <th><a href="https://drafts.csswg.org/css-values/#value-defs">Value:</a> <td class="prod">open <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one③⑤">|</a> closed <tr> <th><a href="https://drafts.csswg.org/css-cascade/#initial-values">Initial:</a> <td>open <tr> <th>Applies to: <td>block-level elements <tr> <th><a href="https://drafts.csswg.org/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://drafts.csswg.org/css-values/#percentages">Percentages:</a> <td>N/A <tr> <th><a href="https://drafts.csswg.org/css-cascade/#computed">Computed value:</a> <td>specified keyword <tr> <th>Canonical order: <td>per grammar <tr> <th><a href="https://drafts.csswg.org/web-animations/#animation-type">Animation type:</a> <td>discrete </table> <dl> <dt><dfn class="css" data-dfn-for="bookmark-state" data-dfn-type="value" data-export id="valdef-bookmark-state-open">open<a class="self-link" href="#valdef-bookmark-state-open"></a></dfn> <dd> Subsequent bookmarks with <a class="property" data-link-type="propdesc" href="#propdef-bookmark-level" id="ref-for-propdef-bookmark-level③">bookmark-level</a> greater than the given bookmark are displayed, until reaching another bookmark of the same level or lower. If one of subsequent bookmark is closed, apply the same test to determine if its subsequent bookmarks should be displayed. <dt><dfn class="css" data-dfn-for="bookmark-state" data-dfn-type="value" data-export id="valdef-bookmark-state-closed">closed<a class="self-link" href="#valdef-bookmark-state-closed"></a></dfn> <dd> Subsequent bookmarks of bookmark-level greater than the given bookmark are not displayed, until reaching another bookmark of the same level or lower. </dl> <p class="issue" id="issue-be5a86f5"><a class="self-link" href="#issue-be5a86f5"></a> Is the initial bookmark state, or the bookmark state updated by the UA as appropriate?</p> <h2 class="heading settled" data-level="5" id="changes"><span class="secno">5. </span><span class="content">Changes since the 2 June 2016 Working Draft</span><a class="self-link" href="#changes"></a></h2> <p>Significant changes since the <a href="https://www.w3.org/TR/2016/WD-css-content-3-20160602/">2 June 2016 Working Draft</a> consist primarily of:</p> <ul> <li>Adding <a class="css" data-link-type="maybe" href="#valdef-quotes-auto" id="ref-for-valdef-quotes-auto①">auto</a> as the initial value of <a class="property" data-link-type="propdesc" href="#propdef-quotes" id="ref-for-propdef-quotes⑤">quotes</a>. <li>Lots of miscellaneous spec clean up: errors, cross-references, overly-loose or sloppy definitions, etc. </ul> <p>See also <a href="https://www.w3.org/TR/2016/WD-css-content-3-20160602/#changes">previous changes</a>.</p> <h2 class="no-num heading settled" id="acknowledgements"><span class="content">Acknowledgements</span><a class="self-link" href="#acknowledgements"></a></h2> <p>Stuart Ballard, David Baron, Bert Bos, <span lang="tr">Tantek Çelik</span>, and James Craig provided invaluable suggestions used in this specification.</p> </main> <h2 class="no-ref no-num heading settled" id="conformance"><span class="content"> Conformance</span><a class="self-link" href="#conformance"></a></h2> <h3 class="heading settled" id="document-conventions"><span class="content"> Document conventions</span><a class="self-link" href="#document-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">[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="highlight">class="example"</code>, like this: </p> <div class="example" id="example-ae2b6bc0"> <a class="self-link" href="#example-ae2b6bc0"></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="highlight">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 class="highlight"><strong class="advisement"></code>, like this: <strong class="advisement"> UAs MUST provide an accessible alternative. </strong> </p> <h3 class="heading settled" id="conform-classes"><span class="content"> Conformance classes</span><a class="self-link" href="#conform-classes"></a></h3> <p>Conformance to this specification is defined for three conformance classes: </p> <dl> <dt>style sheet <dd>A <a href="https://www.w3.org/TR/CSS2/conform.html#style-sheet">CSS style sheet</a>. <dt>renderer <dd>A <a href="https://www.w3.org/TR/CSS2/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="https://www.w3.org/TR/CSS2/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="heading settled" id="conform-responsible"><span class="content"> Requirements for Responsible Implementation of CSS</span><a class="self-link" href="#conform-responsible"></a></h3> <p>The following sections define several conformance requirements for implementing CSS responsibly, in a way that promotes interoperability in the present and future. </p> <h4 class="heading settled" id="conform-partial"><span class="content"> Partial Implementations</span><a class="self-link" href="#conform-partial"></a></h4> <p>So that authors can exploit the forward-compatible parsing rules to assign fallback values, <strong>CSS renderers <em>must</em> treat as invalid (and <a href="https://www.w3.org/TR/CSS2/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</strong>. In particular, user agents <em>must not</em> selectively ignore unsupported property 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="conform-future-proofing"><span class="content"> Implementations of Unstable and Proprietary Features</span><a class="self-link" href="#conform-future-proofing"></a></h4> <p>To avoid clashes with future stable CSS features, the CSSWG recommends <a href="https://www.w3.org/TR/CSS/#future-proofing">following best practices</a> for the implementation of <a href="https://www.w3.org/TR/CSS/#unstable">unstable</a> features and <a href="https://www.w3.org/TR/CSS/#proprietary-extension">proprietary extensions</a> to CSS. </p> <h4 class="heading settled" id="conform-testing"><span class="content"> Implementations of CR-level Features</span><a class="self-link" href="#conform-testing"></a></h4> <p>Once a specification reaches the Candidate Recommendation stage, implementers should release an <a data-link-type="dfn" href="https://www.w3.org/TR/CSS/#vendor-prefix">unprefixed</a> implementation of any CR-level feature they can demonstrate to be correctly implemented according to spec, and should avoid exposing a prefixed variant of that feature. </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="https://www.w3.org/Style/CSS/Test/">https://www.w3.org/Style/CSS/Test/</a>. Questions should be directed to the <a href="https://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a> mailing list. <script src="https://www.w3.org/scripts/TR/2016/fixup.js"></script> </p> <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="#valdef-content-after">after</a><span>, in §2.7.3</span> <li><a href="#valdef-quotes-auto">auto</a><span>, in §2.4.1</span> <li><a href="#valdef-content-before">before</a><span>, in §2.7.3</span> <li><a href="#propdef-bookmark-label">bookmark-label</a><span>, in §4.2</span> <li><a href="#propdef-bookmark-level">bookmark-level</a><span>, in §4.1</span> <li><a href="#bookmarks">bookmarks</a><span>, in §4</span> <li><a href="#propdef-bookmark-state">bookmark-state</a><span>, in §4.3</span> <li><a href="#valdef-bookmark-state-closed">closed</a><span>, in §4.3</span> <li><a href="#valdef-content-close-quote">close-quote</a><span>, in §2.4.2</span> <li><a href="#funcdef-content">content()</a><span>, in §2.7.3</span> <li><a href="#propdef-content">content</a><span>, in §1</span> <li> <content-list> <ul> <li><a href="#typedef-content-content-list">type for content</a><span>, in §1</span> <li><a href="#valdef-bookmark-label-content-list">value for bookmark-label</a><span>, in §4.2</span> </ul> <li><a href="#typedef-content-content-replacement"><content-replacement></a><span>, in §1</span> <li><a href="#valdef-content-contents">contents</a><span>, in §2.3</span> <li><a href="#valdef-leader-dotted">dotted</a><span>, in §2.5.1</span> <li><a href="#entry-value">entry value</a><span>, in §2.7.2</span> <li><a href="#exit-value">exit value</a><span>, in §2.7.2</span> <li><a href="#valdef-string-first">first</a><span>, in §2.7.2</span> <li><a href="#valdef-string-first-except">first-except</a><span>, in §2.7.2</span> <li><a href="#valdef-content-first-letter">first-letter</a><span>, in §2.7.3</span> <li><a href="#valdef-content-list-image"><image></a><span>, in §2.2</span> <li><a href="#valdef-bookmark-level-integer"><integer></a><span>, in §4.1</span> <li><a href="#valdef-string-last">last</a><span>, in §2.7.2</span> <li> leader() <ul> <li><a href="#funcdef-leader">(function)</a><span>, in §2.5.1</span> <li><a href="#funcdef-content-leader">function for content, <content-list></a><span>, in §2.5.1</span> </ul> <li><a href="#typedef-leader-type"><leader-type></a><span>, in §2.5.1</span> <li><a href="#valdef-content-marker">marker</a><span>, in §2.7.3</span> <li><a href="#named-string">named string</a><span>, in §2.7</span> <li><a href="#valdef-content-no-close-quote">no-close-quote</a><span>, in §2.4.2</span> <li> none <ul> <li><a href="#valdef-bookmark-level-none">value for bookmark-level</a><span>, in §4.1</span> <li><a href="#valdef-content-none">value for content</a><span>, in §1</span> <li><a href="#valdef-quotes-none">value for quotes</a><span>, in §2.4.1</span> <li><a href="#valdef-string-set-none">value for string-set</a><span>, in §2.7.1</span> </ul> <li><a href="#valdef-content-no-open-quote">no-open-quote</a><span>, in §2.4.2</span> <li><a href="#valdef-content-normal">normal</a><span>, in §1</span> <li><a href="#valdef-bookmark-state-open">open</a><span>, in §4.3</span> <li><a href="#valdef-content-open-quote">open-quote</a><span>, in §2.4.2</span> <li><a href="#typedef-quote"><quote></a><span>, in §2.4.2</span> <li><a href="#propdef-quotes">quotes</a><span>, in §2.4.1</span> <li><a href="#valdef-leader-solid">solid</a><span>, in §2.5.1</span> <li><a href="#valdef-leader-space">space</a><span>, in §2.5.1</span> <li><a href="#valdef-string-start">start</a><span>, in §2.7.2</span> <li><a href="#funcdef-string">string()</a><span>, in §2.7.2</span> <li> <string> <ul> <li><a href="#valdef-content-string">value for content, <content-list></a><span>, in §2.1</span> <li><a href="#valdef-leader-string">value for leader()</a><span>, in §2.5.1</span> </ul> <li><a href="#valdef-content---string--counter">/ [ <string> | <counter> ]+</a><span>, in §1</span> <li><a href="#propdef-string-set">string-set</a><span>, in §2.7.1</span> <li><a href="#typedef-target"><target></a><span>, in §2.6</span> <li><a href="#funcdef-target-counter">target-counter()</a><span>, in §2.6.1</span> <li><a href="#funcdef-target-counters">target-counters()</a><span>, in §2.6.2</span> <li><a href="#target-text-function">target-text()</a><span>, in §2.6.3</span> <li><a href="#valdef-content-text">text</a><span>, in §2.7.3</span> </ul> <aside class="dfn-panel" data-for="term-for-used-value"> <a href="https://www.w3.org/TR/css-cascade-4/#used-value">https://www.w3.org/TR/css-cascade-4/#used-value</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-used-value">2.4.1. Specifying quotes with the quotes property</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-style-containment"> <a href="https://www.w3.org/TR/css-contain-1/#style-containment">https://www.w3.org/TR/css-contain-1/#style-containment</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-style-containment">2.7.1. The string-set property</a> <li><a href="#ref-for-style-containment①">4. Bookmarks</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-typedef-counter-style"> <a href="https://www.w3.org/TR/css-counter-styles-3/#typedef-counter-style">https://www.w3.org/TR/css-counter-styles-3/#typedef-counter-style</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-counter-style">2.6.1. The target-counter() function</a> <li><a href="#ref-for-typedef-counter-style①">2.6.2. The target-counters() function </a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-invalid-image"> <a href="https://www.w3.org/TR/css4-images/#invalid-image">https://www.w3.org/TR/css4-images/#invalid-image</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-invalid-image">1. Inserting and replacing content with the content property</a> <a href="#ref-for-invalid-image①">(2)</a> <a href="#ref-for-invalid-image②">(3)</a> <li><a href="#ref-for-invalid-image③">2.2. <image></a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-selectordef-after"> <a href="https://www.w3.org/TR/css-pseudo-4/#selectordef-after">https://www.w3.org/TR/css-pseudo-4/#selectordef-after</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-selectordef-after">1. Inserting and replacing content with the content property</a> <a href="#ref-for-selectordef-after①">(2)</a> <li><a href="#ref-for-selectordef-after②">2.7.3. The content() function</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-selectordef-before"> <a href="https://www.w3.org/TR/css-pseudo-4/#selectordef-before">https://www.w3.org/TR/css-pseudo-4/#selectordef-before</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-selectordef-before">1. Inserting and replacing content with the content property</a> <a href="#ref-for-selectordef-before①">(2)</a> <li><a href="#ref-for-selectordef-before②">2.7.3. The content() function</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-selectordef-first-letter"> <a href="https://www.w3.org/TR/css-pseudo-4/#selectordef-first-letter">https://www.w3.org/TR/css-pseudo-4/#selectordef-first-letter</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-selectordef-first-letter">2.7.3. The content() function</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-selectordef-marker"> <a href="https://www.w3.org/TR/css-pseudo-4/#selectordef-marker">https://www.w3.org/TR/css-pseudo-4/#selectordef-marker</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-selectordef-marker">1. Inserting and replacing content with the content property</a> <li><a href="#ref-for-selectordef-marker①">2.3. Element Content</a> <li><a href="#ref-for-selectordef-marker②">2.7.3. The content() function</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-propdef-display"> <a href="https://www.w3.org/TR/css-ruby-1/#propdef-display">https://www.w3.org/TR/css-ruby-1/#propdef-display</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-propdef-display">1. Inserting and replacing content with the content property</a> <a href="#ref-for-propdef-display①">(2)</a> <a href="#ref-for-propdef-display②">(3)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-content-language"> <a href="https://www.w3.org/TR/css-text-3/#content-language">https://www.w3.org/TR/css-text-3/#content-language</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-content-language">2.4.1. Specifying quotes with the quotes property</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-white-space"> <a href="https://www.w3.org/TR/css-text-3/#white-space">https://www.w3.org/TR/css-text-3/#white-space</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-white-space">2.1. String</a> <a href="#ref-for-white-space①">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-integer-value"> <a href="https://www.w3.org/TR/css3-values/#integer-value">https://www.w3.org/TR/css3-values/#integer-value</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-integer-value">4.1. bookmark-level </a> <a href="#ref-for-integer-value①">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-string-value"> <a href="https://www.w3.org/TR/css3-values/#string-value">https://www.w3.org/TR/css3-values/#string-value</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-string-value">1. Inserting and replacing content with the content property</a> <a href="#ref-for-string-value①">(2)</a> <a href="#ref-for-string-value②">(3)</a> <li><a href="#ref-for-string-value③">2.1. String</a> <li><a href="#ref-for-string-value④">2.4.1. Specifying quotes with the quotes property</a> <a href="#ref-for-string-value⑤">(2)</a> <a href="#ref-for-string-value⑥">(3)</a> <a href="#ref-for-string-value⑦">(4)</a> <li><a href="#ref-for-string-value⑧">2.5.1. The leader() function</a> <a href="#ref-for-string-value⑨">(2)</a> <li><a href="#ref-for-string-value①⓪">2.6.1. The target-counter() function</a> <li><a href="#ref-for-string-value①①">2.6.2. The target-counters() function </a> <a href="#ref-for-string-value①②">(2)</a> <li><a href="#ref-for-string-value①③">2.6.3. The target-text() function</a> <li><a href="#ref-for-string-value①④">2.7.1. The string-set property</a> <a href="#ref-for-string-value①⑤">(2)</a> <a href="#ref-for-string-value①⑥">(3)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-url-value"> <a href="https://www.w3.org/TR/css3-values/#url-value">https://www.w3.org/TR/css3-values/#url-value</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-url-value">2.6.1. The target-counter() function</a> <li><a href="#ref-for-url-value①">2.6.2. The target-counters() function </a> <li><a href="#ref-for-url-value②">2.6.3. The target-text() function</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-mult-comma"> <a href="https://www.w3.org/TR/css-values-4/#mult-comma">https://www.w3.org/TR/css-values-4/#mult-comma</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-mult-comma">2.7.1. The string-set property</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-mult-one-plus"> <a href="https://www.w3.org/TR/css-values-4/#mult-one-plus">https://www.w3.org/TR/css-values-4/#mult-one-plus</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-mult-one-plus">1. Inserting and replacing content with the content property</a> <a href="#ref-for-mult-one-plus①">(2)</a> <li><a href="#ref-for-mult-one-plus②">2.4.1. Specifying quotes with the quotes property</a> <li><a href="#ref-for-mult-one-plus③">2.7.1. The string-set property</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-comb-comma"> <a href="https://www.w3.org/TR/css-values-4/#comb-comma">https://www.w3.org/TR/css-values-4/#comb-comma</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-comb-comma">2.6.1. The target-counter() function</a> <a href="#ref-for-comb-comma①">(2)</a> <li><a href="#ref-for-comb-comma②">2.6.2. The target-counters() function </a> <a href="#ref-for-comb-comma③">(2)</a> <a href="#ref-for-comb-comma④">(3)</a> <li><a href="#ref-for-comb-comma⑤">2.6.3. The target-text() function</a> <li><a href="#ref-for-comb-comma⑥">2.7.2. The string() function</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-identifier-value"> <a href="https://www.w3.org/TR/css-values-4/#identifier-value">https://www.w3.org/TR/css-values-4/#identifier-value</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-identifier-value">2.6.1. The target-counter() function</a> <li><a href="#ref-for-identifier-value①">2.6.2. The target-counters() function </a> <li><a href="#ref-for-identifier-value②">2.7.1. The string-set property</a> <a href="#ref-for-identifier-value③">(2)</a> <a href="#ref-for-identifier-value④">(3)</a> <li><a href="#ref-for-identifier-value⑤">2.7.2. The string() function</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-mult-opt"> <a href="https://www.w3.org/TR/css-values-4/#mult-opt">https://www.w3.org/TR/css-values-4/#mult-opt</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-mult-opt">1. Inserting and replacing content with the content property</a> <li><a href="#ref-for-mult-opt①">2.6.1. The target-counter() function</a> <li><a href="#ref-for-mult-opt②">2.6.2. The target-counters() function </a> <li><a href="#ref-for-mult-opt③">2.6.3. The target-text() function</a> <li><a href="#ref-for-mult-opt④">2.7.2. The string() function</a> <li><a href="#ref-for-mult-opt⑤">2.7.3. The content() function</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-comb-one"> <a href="https://www.w3.org/TR/css-values-4/#comb-one">https://www.w3.org/TR/css-values-4/#comb-one</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-comb-one">1. Inserting and replacing content with the content property</a> <a href="#ref-for-comb-one①">(2)</a> <a href="#ref-for-comb-one②">(3)</a> <a href="#ref-for-comb-one③">(4)</a> <a href="#ref-for-comb-one④">(5)</a> <a href="#ref-for-comb-one⑤">(6)</a> <a href="#ref-for-comb-one⑥">(7)</a> <a href="#ref-for-comb-one⑦">(8)</a> <a href="#ref-for-comb-one⑧">(9)</a> <a href="#ref-for-comb-one⑨">(10)</a> <li><a href="#ref-for-comb-one①⓪">2.4.1. Specifying quotes with the quotes property</a> <a href="#ref-for-comb-one①①">(2)</a> <li><a href="#ref-for-comb-one①②">2.4.2. The *-quote values of the content property</a> <a href="#ref-for-comb-one①③">(2)</a> <a href="#ref-for-comb-one①④">(3)</a> <li><a href="#ref-for-comb-one①⑤">2.5.1. The leader() function</a> <a href="#ref-for-comb-one①⑥">(2)</a> <a href="#ref-for-comb-one①⑦">(3)</a> <li><a href="#ref-for-comb-one①⑧">2.6. Cross references and the target-* functions</a> <a href="#ref-for-comb-one①⑨">(2)</a> <li><a href="#ref-for-comb-one②⓪">2.6.1. The target-counter() function</a> <li><a href="#ref-for-comb-one②①">2.6.2. The target-counters() function </a> <li><a href="#ref-for-comb-one②②">2.6.3. The target-text() function</a> <a href="#ref-for-comb-one②③">(2)</a> <a href="#ref-for-comb-one②④">(3)</a> <a href="#ref-for-comb-one②⑤">(4)</a> <li><a href="#ref-for-comb-one②⑥">2.7.1. The string-set property</a> <li><a href="#ref-for-comb-one②⑦">2.7.2. The string() function</a> <a href="#ref-for-comb-one②⑧">(2)</a> <a href="#ref-for-comb-one②⑨">(3)</a> <li><a href="#ref-for-comb-one③⓪">2.7.3. The content() function</a> <a href="#ref-for-comb-one③①">(2)</a> <a href="#ref-for-comb-one③②">(3)</a> <a href="#ref-for-comb-one③③">(4)</a> <li><a href="#ref-for-comb-one③④">4.1. bookmark-level </a> <li><a href="#ref-for-comb-one③⑤">4.3. bookmark-state</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-image-type"> <a href="https://www.w3.org/TR/css3-images/#image-type">https://www.w3.org/TR/css3-images/#image-type</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-image-type">1. Inserting and replacing content with the content property</a> <a href="#ref-for-image-type①">(2)</a> <a href="#ref-for-image-type②">(3)</a> <a href="#ref-for-image-type③">(4)</a> <a href="#ref-for-image-type④">(5)</a> <a href="#ref-for-image-type⑤">(6)</a> <a href="#ref-for-image-type⑥">(7)</a> <a href="#ref-for-image-type⑦">(8)</a> <a href="#ref-for-image-type⑧">(9)</a> <li><a href="#ref-for-image-type⑨">2.2. <image></a> <a href="#ref-for-image-type①⓪">(2)</a> <a href="#ref-for-image-type①①">(3)</a> <a href="#ref-for-image-type①②">(4)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-typedef-counter"> <a href="https://www.w3.org/TR/css-lists-3/#typedef-counter">https://www.w3.org/TR/css-lists-3/#typedef-counter</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-counter">1. Inserting and replacing content with the content property</a> <a href="#ref-for-typedef-counter①">(2)</a> <a href="#ref-for-typedef-counter②">(3)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-propdef-counter-increment"> <a href="https://www.w3.org/TR/css-lists-3/#propdef-counter-increment">https://www.w3.org/TR/css-lists-3/#propdef-counter-increment</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-propdef-counter-increment">3. Automatic counters and numbering: the counter-increment and counter-reset properties (moved)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-propdef-counter-reset"> <a href="https://www.w3.org/TR/css-lists-3/#propdef-counter-reset">https://www.w3.org/TR/css-lists-3/#propdef-counter-reset</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-propdef-counter-reset">3. Automatic counters and numbering: the counter-increment and counter-reset properties (moved)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-the-img-element"> <a href="https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element">https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-the-img-element">1. Inserting and replacing content with the content property</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-target-pseudo"> <a href="https://www.w3.org/TR/selectors4/#target-pseudo">https://www.w3.org/TR/selectors4/#target-pseudo</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-target-pseudo">4. Bookmarks</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-originating-element"> <a href="https://www.w3.org/TR/selectors4/#originating-element">https://www.w3.org/TR/selectors4/#originating-element</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-originating-element">1. Inserting and replacing content with the content property</a> </ul> </aside> <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-cascade-4]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-used-value" style="color:initial">used value</span> </ul> <li> <a data-link-type="biblio">[css-contain-1]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-style-containment" style="color:initial">style containment</span> </ul> <li> <a data-link-type="biblio">[css-counter-styles-3]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-typedef-counter-style" style="color:initial"><counter-style></span> </ul> <li> <a data-link-type="biblio">[css-images-4]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-invalid-image" style="color:initial">invalid image</span> </ul> <li> <a data-link-type="biblio">[css-pseudo-4]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-selectordef-after" style="color:initial">::after</span> <li><span class="dfn-paneled" id="term-for-selectordef-before" style="color:initial">::before</span> <li><span class="dfn-paneled" id="term-for-selectordef-first-letter" style="color:initial">::first-letter</span> <li><span class="dfn-paneled" id="term-for-selectordef-marker" style="color:initial">::marker</span> </ul> <li> <a data-link-type="biblio">[css-ruby-1]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-propdef-display" style="color:initial">display</span> </ul> <li> <a data-link-type="biblio">[CSS-TEXT-3]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-content-language" style="color:initial">content language</span> <li><span class="dfn-paneled" id="term-for-white-space" style="color:initial">white space</span> </ul> <li> <a data-link-type="biblio">[css-values-3]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-integer-value" style="color:initial"><integer></span> <li><span class="dfn-paneled" id="term-for-string-value" style="color:initial"><string></span> <li><span class="dfn-paneled" id="term-for-url-value" style="color:initial"><url></span> </ul> <li> <a data-link-type="biblio">[css-values-4]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-mult-comma" style="color:initial">#</span> <li><span class="dfn-paneled" id="term-for-mult-one-plus" style="color:initial">+</span> <li><span class="dfn-paneled" id="term-for-comb-comma" style="color:initial">,</span> <li><span class="dfn-paneled" id="term-for-identifier-value" style="color:initial"><custom-ident></span> <li><span class="dfn-paneled" id="term-for-mult-opt" style="color:initial">?</span> <li><span class="dfn-paneled" id="term-for-comb-one" style="color:initial">|</span> </ul> <li> <a data-link-type="biblio">[css3-images]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-image-type" style="color:initial"><image></span> </ul> <li> <a data-link-type="biblio">[CSS3LIST]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-typedef-counter" style="color:initial"><counter></span> <li><span class="dfn-paneled" id="term-for-propdef-counter-increment" style="color:initial">counter-increment</span> <li><span class="dfn-paneled" id="term-for-propdef-counter-reset" style="color:initial">counter-reset</span> </ul> <li> <a data-link-type="biblio">[HTML]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-the-img-element" style="color:initial">img</span> </ul> <li> <a data-link-type="biblio">[selectors-4]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-target-pseudo" style="color:initial">:target</span> <li><span class="dfn-paneled" id="term-for-originating-element" style="color:initial">originating element</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-css-cascade-4">[CSS-CASCADE-4] <dd>Elika Etemad; Tab Atkins Jr.. <a href="https://www.w3.org/TR/css-cascade-4/">CSS Cascading and Inheritance Level 4</a>. 28 August 2018. CR. URL: <a href="https://www.w3.org/TR/css-cascade-4/">https://www.w3.org/TR/css-cascade-4/</a> <dt id="biblio-css-contain-1">[CSS-CONTAIN-1] <dd>Tab Atkins Jr.; Florian Rivoal. <a href="https://www.w3.org/TR/css-contain-1/">CSS Containment Module Level 1</a>. 30 April 2019. CR. URL: <a href="https://www.w3.org/TR/css-contain-1/">https://www.w3.org/TR/css-contain-1/</a> <dt id="biblio-css-counter-styles-3">[CSS-COUNTER-STYLES-3] <dd>Tab Atkins Jr.. <a href="https://www.w3.org/TR/css-counter-styles-3/">CSS Counter Styles Level 3</a>. 14 December 2017. CR. URL: <a href="https://www.w3.org/TR/css-counter-styles-3/">https://www.w3.org/TR/css-counter-styles-3/</a> <dt id="biblio-css-images-4">[CSS-IMAGES-4] <dd>Tab Atkins Jr.; Elika Etemad; Lea Verou. <a href="https://www.w3.org/TR/css-images-4/">CSS Image Values and Replaced Content Module Level 4</a>. 13 April 2017. WD. URL: <a href="https://www.w3.org/TR/css-images-4/">https://www.w3.org/TR/css-images-4/</a> <dt id="biblio-css-pseudo-4">[CSS-PSEUDO-4] <dd>Daniel Glazman; Elika Etemad; Alan Stearns. <a href="https://www.w3.org/TR/css-pseudo-4/">CSS Pseudo-Elements Module Level 4</a>. 25 February 2019. WD. URL: <a href="https://www.w3.org/TR/css-pseudo-4/">https://www.w3.org/TR/css-pseudo-4/</a> <dt id="biblio-css-ruby-1">[CSS-RUBY-1] <dd>Elika Etemad; Koji Ishii. <a href="https://www.w3.org/TR/css-ruby-1/">CSS Ruby Layout Module Level 1</a>. 5 August 2014. WD. URL: <a href="https://www.w3.org/TR/css-ruby-1/">https://www.w3.org/TR/css-ruby-1/</a> <dt id="biblio-css-text-3">[CSS-TEXT-3] <dd>Elika Etemad; Koji Ishii; Florian Rivoal. <a href="https://www.w3.org/TR/css-text-3/">CSS Text Module Level 3</a>. 12 December 2018. WD. URL: <a href="https://www.w3.org/TR/css-text-3/">https://www.w3.org/TR/css-text-3/</a> <dt id="biblio-css-values-3">[CSS-VALUES-3] <dd>Tab Atkins Jr.; Elika Etemad. <a href="https://www.w3.org/TR/css-values-3/">CSS Values and Units Module Level 3</a>. 6 June 2019. CR. URL: <a href="https://www.w3.org/TR/css-values-3/">https://www.w3.org/TR/css-values-3/</a> <dt id="biblio-css-values-4">[CSS-VALUES-4] <dd>Tab Atkins Jr.; Elika Etemad. <a href="https://www.w3.org/TR/css-values-4/">CSS Values and Units Module Level 4</a>. 31 January 2019. WD. URL: <a href="https://www.w3.org/TR/css-values-4/">https://www.w3.org/TR/css-values-4/</a> <dt id="biblio-css3-images">[CSS3-IMAGES] <dd>Elika Etemad; Tab Atkins Jr.. <a href="https://www.w3.org/TR/css3-images/">CSS Image Values and Replaced Content Module Level 3</a>. 17 April 2012. CR. URL: <a href="https://www.w3.org/TR/css3-images/">https://www.w3.org/TR/css3-images/</a> <dt id="biblio-css3-speech">[CSS3-SPEECH] <dd>Daniel Weck. <a href="https://www.w3.org/TR/css3-speech/">CSS Speech Module</a>. 5 June 2018. NOTE. URL: <a href="https://www.w3.org/TR/css3-speech/">https://www.w3.org/TR/css3-speech/</a> <dt id="biblio-css3list">[CSS3LIST] <dd>Elika Etemad; Tab Atkins Jr.. <a href="https://www.w3.org/TR/css-lists-3/">CSS Lists Module Level 3</a>. 25 April 2019. WD. URL: <a href="https://www.w3.org/TR/css-lists-3/">https://www.w3.org/TR/css-lists-3/</a> <dt id="biblio-rfc2119">[RFC2119] <dd>S. Bradner. <a href="https://tools.ietf.org/html/rfc2119">Key words for use in RFCs to Indicate Requirement Levels</a>. March 1997. Best Current Practice. URL: <a href="https://tools.ietf.org/html/rfc2119">https://tools.ietf.org/html/rfc2119</a> <dt id="biblio-selectors-4">[SELECTORS-4] <dd>Elika Etemad; Tab Atkins Jr.. <a href="https://www.w3.org/TR/selectors-4/">Selectors Level 4</a>. 21 November 2018. WD. URL: <a href="https://www.w3.org/TR/selectors-4/">https://www.w3.org/TR/selectors-4/</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-cldr">[CLDR] <dd><a href="http://cldr.unicode.org/">Unicode Common Locale Data Repository</a>. URL: <a href="http://cldr.unicode.org/">http://cldr.unicode.org/</a> <dt id="biblio-dom">[DOM] <dd>Anne van Kesteren. <a href="https://dom.spec.whatwg.org/">DOM Standard</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/">HTML Standard</a>. Living Standard. URL: <a href="https://html.spec.whatwg.org/multipage/">https://html.spec.whatwg.org/multipage/</a> </dl> <h2 class="no-num no-ref heading settled" id="property-index"><span class="content">Property Index</span><a class="self-link" href="#property-index"></a></h2> <div class="big-element-wrapper"> <table class="index"> <thead> <tr> <th scope="col">Name <th scope="col">Value <th scope="col">Initial <th scope="col">Applies to <th scope="col">Inh. <th scope="col">%ages <th scope="col">Animation type <th scope="col">Canonical order <th scope="col">Computed value <tbody> <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-bookmark-label" id="ref-for-propdef-bookmark-label③">bookmark-label</a> <td><content-list> <td>content(text) <td>all elements <td>no <td>N/A <td>discrete <td>per grammar <td>specified value <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-bookmark-level" id="ref-for-propdef-bookmark-level④">bookmark-level</a> <td>none | <integer> <td>none <td>all elements <td>no <td>N/A <td>by computed value type <td>per grammar <td>the keyword none or the specified integer <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-bookmark-state" id="ref-for-propdef-bookmark-state④">bookmark-state</a> <td>open | closed <td>open <td>block-level elements <td>no <td>N/A <td>discrete <td>per grammar <td>specified keyword <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-content" id="ref-for-propdef-content①⑥">content</a> <td>normal | none | [ <content-replacement> | <content-list> ] [/ [ <string> | <counter> ]+ ]? <td>normal <td>all elements, tree-abiding pseudo-elements, and page margin boxes <td>no <td>n/a <td>discrete <td>per grammar <td>See prose below <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-quotes" id="ref-for-propdef-quotes⑥">quotes</a> <td>auto | none | [ <string> <string> ]+ <td>auto <td>all elements <td>yes <td>n/a <td>discrete <td>per grammar <td>the keyword none, the keyword auto, or a list, each item a pair of string values <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-string-set" id="ref-for-propdef-string-set⑤">string-set</a> <td>none | [ <custom-ident> <string>+ ]# <td>none <td>all elements, but not pseudo-elements <td>no <td>N/A <td>discrete <td>per grammar <td>the keyword none or a list, each item an identifier paired with a list of string values </table> </div> <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"> The above <a data-link-type="dfn" href="https://www.w3.org/TR/css4-images/#invalid-image">invalid image</a> behavior appears to be what Chrome is doing. Is this okay? Is there a better behavior we can/should use?<a href="#issue-b8fd18a9"> ↵ </a></div> <div class="issue"> "Zero intrinsic width and height" gives it an undefined aspect ratio, and sizing behavior is thus... undefined. At least, if you give it an explicit width or height, the other dimension remains at zero in Chrome. This might need to be explicitly defined over in the Images spec; needs some investigation around whether browsers act this way for 0x0 SVGs and rasters.<a href="#issue-76d40dad"> ↵ </a></div> <div class="issue"> Should the contents keyword be replaced with <a class="css" data-link-type="maybe" href="#funcdef-content">content()</a>?<a href="#issue-a8fbc981"> ↵ </a></div> <div class="issue"> Start work on an AAM for CSS.<a href="#issue-9c60e2c1"> ↵ </a></div> <div class="issue"> CSS2.1 explicitly allowed the UA to substitute a broken image icon if the image was invalid. However, no browser appears to do this. Is this removal okay?<a href="#issue-3ef3081c"> ↵ </a></div> <div class="issue"> Should this behave as an empty string on pseudo-elements?<a href="#issue-bf2f178e"> ↵ </a></div> <div class="issue"> Use cases for suppressing the content on the element and using it in a pseudo-element would be welcome.<a href="#issue-bfc60bbc"> ↵ </a></div> <div class="issue"> Do we need the statement about marker pseudo-elements here? Or is this legacy from the old version of the spec?<a href="#issue-9fa9cc25"> ↵ </a></div> <div class="issue"> Do leaders depend on the assumption that the content after the leader is right-aligned (end-aligned)?<a href="#issue-2f5c8d3f"> ↵ </a></div> <div class="issue"> what to do if <var>after content</var> is wider than the line box?<a href="#issue-449754e4"> ↵ </a></div> <div class="issue"> Leaders don’t quite work in table layouts. How can we fix this?<a href="#issue-bb18b3e4"> ↵ </a></div> <div class="issue"> what should error handling be?<a href="#issue-7443dd19"> ↵ </a></div> <div class="issue"> restrict syntactically to local references for now.<a href="#issue-2b2bd98b"> ↵ </a></div> <div class="issue"> found a compelling example, in CSS specs. Do something.<a href="#issue-6e7203db"> ↵ </a></div> <div class="issue"> A simpler syntax has been proposed by fantasai: <a href="https://lists.w3.org/Archives/Public/www-style/2012Feb/0745.html">https://lists.w3.org/Archives/Public/www-style/2012Feb/0745.html</a><a href="#issue-a82075c9"> ↵ </a></div> <div class="issue"> we may need to kill the entire content string. Is this necessary?<a href="#issue-c24bc3d7"> ↵ </a></div> <div class="issue"> Now described in <a data-link-type="biblio" href="#biblio-css3list">[CSS3LIST]</a><a href="#issue-227d7dec"> ↵ </a></div> <div class="issue"> Should this move back to CSS Content?<a href="#issue-0161c10e"> ↵ </a></div> <div class="issue"> Should a bookmark be created for elements with <code class="highlight">display: none</code>?<a href="#issue-de0f5f60"> ↵ </a></div> <div class="issue"> Is the initial bookmark state, or the bookmark state updated by the UA as appropriate?<a href="#issue-be5a86f5"> ↵ </a></div> </div> <aside class="dfn-panel" data-for="propdef-content"> <b><a href="#propdef-content">#propdef-content</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-propdef-content">1. Inserting and replacing content with the content property</a> <a href="#ref-for-propdef-content①">(2)</a> <a href="#ref-for-propdef-content②">(3)</a> <li><a href="#ref-for-propdef-content③">1.1. Accessibility of Generated Content</a> <li><a href="#ref-for-propdef-content④">1.2. Alternative Text for Accessibility</a> <li><a href="#ref-for-propdef-content⑤">2. <content-list> Values and Functions</a> <li><a href="#ref-for-propdef-content⑥">2.1. String</a> <li><a href="#ref-for-propdef-content⑦">2.3. Element Content</a> <a href="#ref-for-propdef-content⑧">(2)</a> <a href="#ref-for-propdef-content⑨">(3)</a> <li><a href="#ref-for-propdef-content①⓪">2.4. Quotes</a> <li><a href="#ref-for-propdef-content①①">2.4.1. Specifying quotes with the quotes property</a> <a href="#ref-for-propdef-content①②">(2)</a> <li><a href="#ref-for-propdef-content①③">2.4.2. The *-quote values of the content property</a> <li><a href="#ref-for-propdef-content①④">2.7. Named strings</a> <li><a href="#ref-for-propdef-content①⑤">2.7.2. The string() function</a> </ul> </aside> <aside class="dfn-panel" data-for="valdef-content-normal"> <b><a href="#valdef-content-normal">#valdef-content-normal</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-content-normal">1. Inserting and replacing content with the content property</a> <li><a href="#ref-for-valdef-content-normal①">2.3. Element Content</a> <a href="#ref-for-valdef-content-normal②">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="valdef-content-none"> <b><a href="#valdef-content-none">#valdef-content-none</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-content-none">1. Inserting and replacing content with the content property</a> <li><a href="#ref-for-valdef-content-none①">2.3. Element Content</a> <a href="#ref-for-valdef-content-none②">(2)</a> <a href="#ref-for-valdef-content-none③">(3)</a> <li><a href="#ref-for-valdef-content-none④">2.4.2. The *-quote values of the content property</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-content-content-replacement"> <b><a href="#typedef-content-content-replacement">#typedef-content-content-replacement</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-content-content-replacement">1. Inserting and replacing content with the content property</a> <a href="#ref-for-typedef-content-content-replacement①">(2)</a> <a href="#ref-for-typedef-content-content-replacement②">(3)</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-content-content-list"> <b><a href="#typedef-content-content-list">#typedef-content-content-list</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-content-content-list">1. Inserting and replacing content with the content property</a> <a href="#ref-for-typedef-content-content-list①">(2)</a> <a href="#ref-for-typedef-content-content-list②">(3)</a> <li><a href="#ref-for-typedef-content-content-list③">1.2. Alternative Text for Accessibility</a> <li><a href="#ref-for-typedef-content-content-list④">2. <content-list> Values and Functions</a> <a href="#ref-for-typedef-content-content-list⑤">(2)</a> <li><a href="#ref-for-typedef-content-content-list⑥">4.2. bookmark-label</a> <a href="#ref-for-typedef-content-content-list⑦">(2)</a> <a href="#ref-for-typedef-content-content-list⑧">(3)</a> <a href="#ref-for-typedef-content-content-list⑨">(4)</a> </ul> </aside> <aside class="dfn-panel" data-for="valdef-content-contents"> <b><a href="#valdef-content-contents">#valdef-content-contents</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-content-contents">1. Inserting and replacing content with the content property</a> <li><a href="#ref-for-valdef-content-contents①">2.3. Element Content</a> <a href="#ref-for-valdef-content-contents②">(2)</a> <a href="#ref-for-valdef-content-contents③">(3)</a> </ul> </aside> <aside class="dfn-panel" data-for="propdef-quotes"> <b><a href="#propdef-quotes">#propdef-quotes</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-propdef-quotes">2.4.1. Specifying quotes with the quotes property</a> <a href="#ref-for-propdef-quotes①">(2)</a> <li><a href="#ref-for-propdef-quotes②">2.4.2. The *-quote values of the content property</a> <a href="#ref-for-propdef-quotes③">(2)</a> <a href="#ref-for-propdef-quotes④">(3)</a> <li><a href="#ref-for-propdef-quotes⑤">5. Changes since the 2 June 2016 Working Draft</a> </ul> </aside> <aside class="dfn-panel" data-for="valdef-quotes-none"> <b><a href="#valdef-quotes-none">#valdef-quotes-none</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-quotes-none">2.4.1. Specifying quotes with the quotes property</a> </ul> </aside> <aside class="dfn-panel" data-for="valdef-quotes-auto"> <b><a href="#valdef-quotes-auto">#valdef-quotes-auto</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-quotes-auto">2.4.1. Specifying quotes with the quotes property</a> <li><a href="#ref-for-valdef-quotes-auto①">5. Changes since the 2 June 2016 Working Draft</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-quote"> <b><a href="#typedef-quote">#typedef-quote</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-quote">1. Inserting and replacing content with the content property</a> <li><a href="#ref-for-typedef-quote①">2.4.2. The *-quote values of the content property</a> </ul> </aside> <aside class="dfn-panel" data-for="valdef-content-open-quote"> <b><a href="#valdef-content-open-quote">#valdef-content-open-quote</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-content-open-quote">2.4.1. Specifying quotes with the quotes property</a> <a href="#ref-for-valdef-content-open-quote①">(2)</a> <li><a href="#ref-for-valdef-content-open-quote②">2.4.2. The *-quote values of the content property</a> <a href="#ref-for-valdef-content-open-quote③">(2)</a> <a href="#ref-for-valdef-content-open-quote④">(3)</a> <a href="#ref-for-valdef-content-open-quote⑤">(4)</a> <a href="#ref-for-valdef-content-open-quote⑥">(5)</a> </ul> </aside> <aside class="dfn-panel" data-for="valdef-content-close-quote"> <b><a href="#valdef-content-close-quote">#valdef-content-close-quote</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-content-close-quote">2.4.1. Specifying quotes with the quotes property</a> <a href="#ref-for-valdef-content-close-quote①">(2)</a> <li><a href="#ref-for-valdef-content-close-quote②">2.4.2. The *-quote values of the content property</a> <a href="#ref-for-valdef-content-close-quote③">(2)</a> <a href="#ref-for-valdef-content-close-quote④">(3)</a> <a href="#ref-for-valdef-content-close-quote⑤">(4)</a> <a href="#ref-for-valdef-content-close-quote⑥">(5)</a> </ul> </aside> <aside class="dfn-panel" data-for="valdef-content-no-open-quote"> <b><a href="#valdef-content-no-open-quote">#valdef-content-no-open-quote</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-content-no-open-quote">2.4.1. Specifying quotes with the quotes property</a> <li><a href="#ref-for-valdef-content-no-open-quote①">2.4.2. The *-quote values of the content property</a> </ul> </aside> <aside class="dfn-panel" data-for="valdef-content-no-close-quote"> <b><a href="#valdef-content-no-close-quote">#valdef-content-no-close-quote</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-content-no-close-quote">2.4.1. Specifying quotes with the quotes property</a> <li><a href="#ref-for-valdef-content-no-close-quote①">2.4.2. The *-quote values of the content property</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-leader-type"> <b><a href="#typedef-leader-type">#typedef-leader-type</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-leader-type">2.5.1. The leader() function</a> <a href="#ref-for-typedef-leader-type①">(2)</a> <a href="#ref-for-typedef-leader-type②">(3)</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-target"> <b><a href="#typedef-target">#typedef-target</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-target">1. Inserting and replacing content with the content property</a> <li><a href="#ref-for-typedef-target①">2.6. Cross references and the target-* functions</a> </ul> </aside> <aside class="dfn-panel" data-for="funcdef-target-counter"> <b><a href="#funcdef-target-counter">#funcdef-target-counter</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-funcdef-target-counter">2.6. Cross references and the target-* functions</a> <a href="#ref-for-funcdef-target-counter①">(2)</a> <li><a href="#ref-for-funcdef-target-counter②">2.6.1. The target-counter() function</a> <a href="#ref-for-funcdef-target-counter③">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="funcdef-target-counters"> <b><a href="#funcdef-target-counters">#funcdef-target-counters</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-funcdef-target-counters">2.6. Cross references and the target-* functions</a> <a href="#ref-for-funcdef-target-counters①">(2)</a> <li><a href="#ref-for-funcdef-target-counters②">2.6.2. The target-counters() function </a> </ul> </aside> <aside class="dfn-panel" data-for="target-text-function"> <b><a href="#target-text-function">#target-text-function</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-target-text-function">2.6. Cross references and the target-* functions</a> <a href="#ref-for-target-text-function①">(2)</a> <li><a href="#ref-for-target-text-function②">2.6.3. The target-text() function</a> <a href="#ref-for-target-text-function③">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="named-string"> <b><a href="#named-string">#named-string</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-named-string">2.7.2. The string() function</a> </ul> </aside> <aside class="dfn-panel" data-for="propdef-string-set"> <b><a href="#propdef-string-set">#propdef-string-set</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-propdef-string-set">2.6.3. The target-text() function</a> <li><a href="#ref-for-propdef-string-set①">2.7. Named strings</a> <li><a href="#ref-for-propdef-string-set②">2.7.1. The string-set property</a> <a href="#ref-for-propdef-string-set③">(2)</a> <li><a href="#ref-for-propdef-string-set④">4.2. bookmark-label</a> </ul> </aside> <aside class="dfn-panel" data-for="valdef-string-set-none"> <b><a href="#valdef-string-set-none">#valdef-string-set-none</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-string-set-none">2.7.1. The string-set property</a> </ul> </aside> <aside class="dfn-panel" data-for="funcdef-string"> <b><a href="#funcdef-string">#funcdef-string</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-funcdef-string">2.7.1. The string-set property</a> <a href="#ref-for-funcdef-string①">(2)</a> <li><a href="#ref-for-funcdef-string②">2.7.2. The string() function</a> <a href="#ref-for-funcdef-string③">(2)</a> <a href="#ref-for-funcdef-string④">(3)</a> </ul> </aside> <aside class="dfn-panel" data-for="valdef-string-first"> <b><a href="#valdef-string-first">#valdef-string-first</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-string-first">2.7.2. The string() function</a> </ul> </aside> <aside class="dfn-panel" data-for="entry-value"> <b><a href="#entry-value">#entry-value</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-entry-value">2.7.2. The string() function</a> <a href="#ref-for-entry-value①">(2)</a> <a href="#ref-for-entry-value②">(3)</a> </ul> </aside> <aside class="dfn-panel" data-for="exit-value"> <b><a href="#exit-value">#exit-value</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-exit-value">2.7.2. The string() function</a> <a href="#ref-for-exit-value①">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="funcdef-content"> <b><a href="#funcdef-content">#funcdef-content</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-funcdef-content">1. Inserting and replacing content with the content property</a> <li><a href="#ref-for-funcdef-content①">2.7.3. The content() function</a> <a href="#ref-for-funcdef-content②">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="valdef-content-text"> <b><a href="#valdef-content-text">#valdef-content-text</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-content-text">2.7.3. The content() function</a> </ul> </aside> <aside class="dfn-panel" data-for="propdef-bookmark-level"> <b><a href="#propdef-bookmark-level">#propdef-bookmark-level</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-propdef-bookmark-level">4. Bookmarks</a> <a href="#ref-for-propdef-bookmark-level①">(2)</a> <li><a href="#ref-for-propdef-bookmark-level②">4.1. bookmark-level </a> <li><a href="#ref-for-propdef-bookmark-level③">4.3. bookmark-state</a> </ul> </aside> <aside class="dfn-panel" data-for="valdef-bookmark-level-none"> <b><a href="#valdef-bookmark-level-none">#valdef-bookmark-level-none</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-bookmark-level-none">4.1. bookmark-level </a> <a href="#ref-for-valdef-bookmark-level-none①">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="propdef-bookmark-label"> <b><a href="#propdef-bookmark-label">#propdef-bookmark-label</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-propdef-bookmark-label">4. Bookmarks</a> <a href="#ref-for-propdef-bookmark-label①">(2)</a> <li><a href="#ref-for-propdef-bookmark-label②">4.1. bookmark-level </a> </ul> </aside> <aside class="dfn-panel" data-for="propdef-bookmark-state"> <b><a href="#propdef-bookmark-state">#propdef-bookmark-state</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-propdef-bookmark-state">4. Bookmarks</a> <a href="#ref-for-propdef-bookmark-state①">(2)</a> <li><a href="#ref-for-propdef-bookmark-state②">4.1. bookmark-level </a> <li><a href="#ref-for-propdef-bookmark-state③">4.3. bookmark-state</a> </ul> </aside> <script>/* script-dfn-panel */ document.body.addEventListener("click", function(e) { var queryAll = function(sel) { return [].slice.call(document.querySelectorAll(sel)); } // Find the dfn element or panel, if any, that was clicked on. var el = e.target; var target; var hitALink = false; while(el.parentElement) { if(el.tagName == "A") { // Clicking on a link in a <dfn> shouldn't summon the panel hitALink = true; } if(el.classList.contains("dfn-paneled")) { target = "dfn"; break; } if(el.classList.contains("dfn-panel")) { target = "dfn-panel"; break; } el = el.parentElement; } if(target != "dfn-panel") { // Turn off any currently "on" or "activated" panels. queryAll(".dfn-panel.on, .dfn-panel.activated").forEach(function(el){ el.classList.remove("on"); el.classList.remove("activated"); }); } if(target == "dfn" && !hitALink) { // open the panel var dfnPanel = document.querySelector(".dfn-panel[data-for='" + el.id + "']"); if(dfnPanel) { dfnPanel.classList.add("on"); var rect = el.getBoundingClientRect(); dfnPanel.style.left = window.scrollX + rect.right + 5 + "px"; dfnPanel.style.top = window.scrollY + rect.top + "px"; var panelRect = dfnPanel.getBoundingClientRect(); var panelWidth = panelRect.right - panelRect.left; if(panelRect.right > document.body.scrollWidth && (rect.left - (panelWidth + 5)) > 0) { // Reposition, because the panel is overflowing dfnPanel.style.left = window.scrollX + rect.left - (panelWidth + 5) + "px"; } } else { console.log("Couldn't find .dfn-panel[data-for='" + el.id + "']"); } } else if(target == "dfn-panel") { // Switch it to "activated" state, which pins it. el.classList.add("activated"); el.style.left = null; el.style.top = null; } }); </script>