FFFF csswg-drafts/css-lists/Overview.html at c68aeb3df2803f49343081ac0f2b61de4c5f2178 · w3c/csswg-drafts · GitHub
Skip to content

Latest commit

 

History

History
executable file
·
2562 lines (2009 loc) · 79.5 KB

File metadata and controls

executable file
·
2562 lines (2009 loc) · 79.5 KB
<!DOCTYPE html>
<html>
<head>
<title>CSS Lists and Counters Module Level 3</title>
<!--
<link href="http://purl.org/dc/terms/" rel="schema.dcterms">
<link href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright" rel="dcterms.rights">
-->
<meta content="CSS Lists and Counters Module Level 3" name=dcterms.title>
<meta content=text name=dcterms.type>
<meta content=2013-02-19 name=dcterms.issued>
<meta content="http://dev.w3.org/csswg/css3-lists/" name=dcterms.creator>
<meta content=W3C name=dcterms.publisher>
<meta content="http://dev.w3.org/csswg/css3-lists/"
name=dcterms.identifier>
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
<link href="http://dev.w3.org/csswg/default.css" rel=stylesheet
type="text/css">
<link href="../csslogo.ico" rel="shortcut icon" type="image/x-icon">
<style>
code.inline { white-space: nowrap; }
.alphabetic-example { font-family: monospace; font-size: 90%; margin: 1em 0 1em 2em; }
.alphabetic-example > span { display: inline-block; width: 50px;}
.alphabetic-example > span > img { width: 16px; height: 16px; }
pre > code { white-space: pre-wrap; }
.nobr { white-space: nowrap;}
</style>
<link href="http://www.w3.org/StyleSheets/TR/W3C-ED" rel=stylesheet
type="text/css">
<body>
<div class=head> <!--begin-logo-->
<p><a href="http://www.w3.org/"><img alt=W3C height=48
src="http://www.w3.org/Icons/w3c_home" width=72></a> <!--end-logo-->
<h1>CSS Lists and Counters Module Level 3</h1>
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 19 February
2013</h2>
<dl>
<dt>This version:
<dd><!--<a href="http://www.w3.org/TR/2013/WD-css3-lists-20130219">http://www.w3.org/TR/2013/WD-css3-lists-20130219</a>-->
<a
href="http://dev.w3.org/csswg/css3-lists/">http://dev.w3.org/csswg/css3-lists/</a>
<dt>Latest version:
<dd><a
href="http://www.w3.org/TR/css3-lists/">http://www.w3.org/TR/css3-lists/</a>
<dt>Editor's Draft:
<dd><a
href="http://dev.w3.org/csswg/css3-lists/">http://dev.w3.org/csswg/css3-lists/</a>
<dt>Previous version:
<dd><a
href="http://www.w3.org/TR/2011/WD-css3-lists-20110524/">http://www.w3.org/TR/2011/WD-css3-lists-20110524/</a>
<dt>Issue Tracking:
<dd><a
href="https://www.w3.org/Bugs/Public/buglist.cgi?product=CSS&component=Lists%20and%20Counters&resolution=---">Bugzilla</a>
<dt>Feedback:</dt>
<dd><a href="mailto:www-style@w3.org?subject=%5Bcss-lists%5D%20feedback"
>www-style@w3.org</a>
with subject line &ldquo;<kbd>[css-lists]
<var>&hellip; message topic &hellip;</var></kbd>&rdquo;
(<a rel="discussion" href="http://lists.w3.org/Archives/Public/www-style/"
>archives</a>)
<dt>Editor:
<dd class=vcard> <a class=url href="http://xanthir.com/contact/"> <span
class=fn>Tab Atkins Jr.</span>, </a> <span class=org>Google, Inc.</span>
<dt>Previous Editors: <!-- in the order tantek requested -->
<dd>Ian Hickson, <a href="mailto:ian@hixie.ch">ian@hixie.ch</a>
<dd><span lang=tr>Tantek Çelı̇k</span>, Microsoft Corporation, <a
href="mailto:tantekc@microsoft.com">tantekc@microsoft.com</a>
<dt>Contributors: <!-- in order of volume of input -->
<dd>Simon Montagu, AOL-TW/Netscape, <a
href="mailto:smontagu@netscape.com">smontagu@netscape.com</a>
<dd>Daniel Yacob, <a href="mailto:yacob@geez.org">yacob@geez.org</a>
<dd>Christopher Hoess, <a
href="mailto:choess@stwing.upenn.edu">choess@stwing.upenn.edu</a>
<dd>Daniel Glazman, AOL-TW/Netscape, <a
href="mailto:glazman@netscape.com">glazman@netscape.com</a>
</dl>
<!--begin-copyright-->
<p class=copyright><a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
rel=license>Copyright</a> © 2013 <a href="http://www.w3.org/"><abbr
title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a
href="http://www.csail.mit.edu/"><abbr
title="Massachusetts Institute of Technology">MIT</abbr></a>, <a
href="http://www.ercim.eu/"><abbr
title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
<a href="http://www.keio.ac.jp/">Keio</a>, <a
href="http://ev.buaa.edu.cn/">Beihang</a>), All Rights Reserved. W3C <a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a
href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
and <a
href="http://www.w3.org/Consortium/Legal/copyright-documents">document
use</a> rules apply.</p>
<!--end-copyright-->
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc" id=abstract> Abstract</h2>
<p>CSS is a language for describing the rendering of structured documents
(such as HTML and XML) on screen, on paper, in speech, etc. This draft
contains the features of CSS level 3 relating to list styling. It
includes and extends the functionality of CSS level 2 <a href="#CSS21"
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>, which builds on CSS level 1
<a href="#CSS1" rel=biblioentry>[CSS1]<!--{{CSS1}}--></a>. The main
extensions compared to level 2 are a pseudo-element representing the list
marker, and a method for authors to define their own list-styles.
<h2 class="no-num no-toc" id=status> Status of this document</h2>
<!--begin-status-->
<p>This is a public copy of the editors' draft. It is provided for
discussion only and may change at any moment. Its publication here does
not imply endorsement of its contents by W3C. Don't cite this document
other than as work in progress.
<p>The (<a
href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) public
mailing list <a
href="mailto:www-style@w3.org?Subject=%5Bcss3-lists%5D%20PUT%20SUBJECT%20HERE">
www-style@w3.org</a> (see <a
href="http://www.w3.org/Mail/Request">instructions</a>) is preferred for
discussion of this specification. When sending e-mail, please put the text
“css3-lists” in the subject, preferably like this:
“[<!---->css3-lists<!---->] <em>…summary of comment…</em>”
<p>This document was produced by the <a href="/Style/CSS/members">CSS
Working Group</a> (part of the <a href="/Style/">Style Activity</a>).
<p>This document was produced by a group operating under the <a
href="/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent
Policy</a>. W3C maintains a <a href="/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="/Consortium/Patent-Policy-20040205/#def-essential">Essential
Claim(s)</a> must disclose the information in accordance with <a
href="/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the
W3C Patent Policy</a>.</p>
<!--end-status-->
<h2 class="no-num no-toc" id=contents> Table of contents</h2>
<!--begin-toc-->
<ul class=toc>
<li><a href="#introduction"><span class=secno>1. </span> Introduction</a>
<li><a href="#declaring-a-list-item"><span class=secno>2. </span>
Declaring a List Item</a>
<li><a href="#marker-content"><span class=secno>3. </span> Default Marker
Contents: The ‘<code class=property>list-style-image</code>’ and
‘<code class=property>list-style-type</code>’ properties</a>
<li><a href="#list-style-position-property"><span class=secno>4. </span>
Marker Position: The ‘<code
class=property>list-style-position</code>’ property</a>
<li><a href="#list-style-property"><span class=secno>5. </span> The
‘<code class=property>list-style</code>’ shorthand property</a>
<li><a href="#marker-pseudo-element"><span class=secno>6. </span> Markers:
The ‘<code class=css>::marker</code>’ pseudo-element</a>
<ul class=toc>
<li><a href="#content-property"><span class=secno>6.1. </span>
Generating the value of the ‘<code class=property>content</code>’
property</a>
</ul>
<li><a href="#positioning-markers"><span class=secno>7. </span>
Positioning Markers</a>
<ul class=toc>
<li><a href="#position-marker"><span class=secno>7.1. </span> The
‘<code class=css>marker</code>’ value for ‘<code
class=property>position</code>’</a>
<li><a href="#marker-side"><span class=secno>7.2. </span> The ‘<code
class=property>marker-side</code>’ property</a>
</ul>
<li><a href="#counter"><span class=secno>8. </span> Automatic Numbering
With Counters</a>
<ul class=toc>
<li><a href="#counter-properties"><span class=secno>8.1. </span>
Manipulating Counters: the ‘<code
class=property>counter-increment</code>’, ‘<code
class=property>counter-set</code>’ and ‘<code
class=property>counter-reset</code>’ properties </a>
<li><a href="#creating-counters"><span class=secno>8.2. </span> Creating
and Inheriting Counters</a>
<li><a href="#nested-counters"><span class=secno>8.3. </span> Nested
Counters</a>
<li><a href="#counters-without-boxes"><span class=secno>8.4. </span>
Counters in elements that do not generate boxes</a>
</ul>
<li><a href="#counter-function"><span class=secno>9. </span> Printing
Counters: the <code title=counter-function>counter()</code> and <code
title=counters-function>counters()</code> functions</a>
<li><a href="#ua-stylesheet"><span class=secno>10. </span> Sample style
sheet for HTML</a>
<li class=no-num><a href="#profiles"> Profiles</a>
<li class=no-num><a href="#acknowledgments"> Acknowledgments</a>
<li class=no-num><a href="#changes"> Changes From CSS2.1</a>
<li class=no-num><a href="#references">References</a>
<ul class=toc>
<li class=no-num><a href="#normative-references">Normative
references</a>
<li class=no-num><a href="#other-references">Other references</a>
</ul>
<li class=no-num><a href="#property-index">Property index</a>
<li class=no-num><a href="#index">Index</a>
</ul>
<!--end-toc-->
<hr>
<!-- ====================================================================== -->
<h2 id=introduction><span class=secno>1. </span> Introduction</h2>
<p> This specification defines the ‘<code class=css>::marker</code>’
pseudo-element, the ‘<code class=css>list-item</code>’ and ‘<a
href="#inline-list-item"><code class=css>inline-list-item</code></a>’
‘<code class=property>display</code>’ values that generate markers,
and several properties controlling the placement and styling of markers.
<p> It also defines <i>counters</i>, which are special numerical objects
often used to generate the default contents of markers.
<div class=example>
<p> For instance, the following example illustrates how markers may be
used to add parentheses around each numbered list item:
<pre><!--
-->&lt;style>
<!--
-->li::marker { content: "(" counter(list-item, lower-roman) ")"; }
<!--
-->li { display: list-item; }
<!--
-->&lt;/style>
<!--
-->&lt;ol>
<!--
--> &lt;li>This is the first item.&lt;/li>
<!--
--> &lt;li>This is the second item.&lt;/li>
<!--
--> &lt;li>This is the third item.&lt;/li>
<!--
-->&lt;/ol></pre>
<p> It should produce something like this:
<pre><!--
--> (i) This is the first item.
<!--
--> (ii) This is the second item.
<!--
-->(iii) This is the third item.</pre>
<p class=note> Note that this example is far more verbose than is usually
needed in HTML, as the UA default style sheet takes care of most of the
necessary styling.
</div>
<p> With descendant selectors and child selectors, it's possible to specify
different marker types depending on the depth of embedded lists.
<p class=issue> A future release of this module will probably include ways
to render tree lists.
<!-- ====================================================================== -->
<h2 id=declaring-a-list-item><span class=secno>2. </span> Declaring a List
Item</h2>
<p> A <dfn id=list-item title="list item|list items">list item</dfn> is any
element with its ‘<code class=property>display</code>’ property set to
‘<code class=css>list-item</code>’ or ‘<a
href="#inline-list-item"><code class=css>inline-list-item</code></a>’.
<a href="#list-item"><i>List items</i></a> generate ‘<code
class=css>::marker</code>’ pseudo-elements; no other elements do.
<p> Additionally, <a href="#list-item"><i>list items</i></a> automatically
increment the special ‘<code class=css>list-item</code>’ <a
href="#counter0"><i>counter</i></a>. Unless the ‘<a
href="#counter-increment"><code
class=property>counter-increment</code></a>’ property manually specifies
a different increment for the ‘<code class=css>list-item</code>’ <a
href="#counter0"><i>counter</i></a>, it must be incremented by 1 on every
<a href="#list-item"><i>list item</i></a>, at the same time that
<i>counters</i> are normally incremented. (This has no effect on the
values of the ‘<code class=css>counter-*</code>’ properties.)
<table class=propdef>
<tbody>
<tr>
<th>Property:
<td>‘<code class=property>display</code>’
<tr>
<th>New Value:
<td><dfn id=inline-list-item>inline-list-item</dfn>
<tr>
<th>Initial:
<td>same as CSS2.1
<tr>
<th>Applies to:
<td>same as CSS2.1
<tr>
<th>Inherited:
<td>same as CSS2.1
<tr>
<th>Percentages:
<td>same as CSS2.1
<tr>
<th>Media:
<td>same as CSS2.1
<tr>
<th>Computed value:
<td>same as CSS2.1
</table>
<p> The ‘<a href="#inline-list-item"><code
class=css>inline-list-item</code></a>’ display value makes the element a
<a href="#list-item"><i>list item</i></a>, with the effects described
above. Additionally, the ‘<a href="#list-style-position-outside"><code
class=css>outside</code></a>’ value of ‘<a
href="#list-style-position"><code
class=property>list-style-position</code></a>’ computes to ‘<a
href="#list-style-position-inside"><code class=css>inside</code></a>’ on
this element. Otherwise, this display value is treated identically to
‘<code class=css>inline</code>’.
<p class=note> This display value is silly, and only necessary because we
haven't yet defined ‘<code class=property>display</code>’ to be split
into subproperties. When that happens, "being a list item" will just be a
property value that can apply to block, inline, and other elements.
<!-- ====================================================================== -->
<h2 id=marker-content><span class=secno>3. </span> Default Marker Contents:
The ‘<a href="#list-style-image"><code
class=property>list-style-image</code></a>’ and ‘<a
href="#list-style-type"><code class=property>list-style-type</code></a>’
properties</h2>
<p> The contents of a ‘<code class=css>::marker</code>’ pseudo-element
can be generated automatically, rather than being specified explicitly
with ‘<code class=property>content</code>’. The ‘<a
href="#list-style-image"><code
class=property>list-style-image</code></a>’ and ‘<a
href="#list-style-type"><code class=property>list-style-type</code></a>’
properties control how these contents are generated.
<table class=propdef>
<tbody>
<tr>
<th>Name:
<td><dfn id=list-style-image>list-style-image</dfn>
<tr>
<th>Value:
<td>&lt;image> | none
<tr>
<th>Initial
<td>none
<tr>
<th>Applies To:
<td><a href="#list-item"><i title="list item">list items</i></a>
<tr>
<th>Inherited:
<td>yes
<tr>
<th>Percentages:
<td>N/A
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed Value:
<td>computed value of the &lt;image>, or ‘<a
href="#list-style-type-none"><code class=css>none</code></a>’
</table>
<p> The ‘<a href="#list-style-type"><code
class=property>list-style-type</code></a>’ property specifies an image
that will be used as the list marker's <a
href="#default-contents"><i>default contents</i></a>. The values are
defined as follows:
<dl>
<dt><dfn id=list-style-image-image>&lt;image></dfn>
<dd> If the <a href="#list-style-image-image"><code>&lt;image></code></a>
is not an <a
href="http://www.w3.org/TR/css3-images/#invalid-image">invalid image</a>,
the image is the <a href="#default-contents"><i>default contents</i></a>
of the list item's marker. Otherwise, the <a
href="#default-contents"><i>default contents</i></a> are given by ‘<a
href="#list-style-type"><code
class=property>list-style-type</code></a>’ instead.
<dt><dfn id=list-style-image-none>none</dfn>
<dd> The <a href="#default-contents"><i>default contents</i></a> of the of
the list item's marker are given by ‘<a href="#list-style-type"><code
class=property>list-style-type</code></a>’ instead.
</dl>
<div class=example>
<p>The following example sets the marker at the beginning of each list
item to be the image "ellipse.png".
<pre>li { list-style-image: url("http://www.example.com/ellipse.png") }</pre>
</div>
<table class=propdef>
<tbody>
<tr>
<th>Name:
<td><dfn id=list-style-type>list-style-type</dfn>
<tr>
<th>Value:
<td>&lt;string> | &lt;counter-style-name> | &lt;symbols-function> | none
<tr>
<th>Initial:
<td>disc
<tr>
<th>Applies To:
<td><a href="#list-item"><i>list items</i></a>
<tr>
<th>Inherited:
<td>yes
<tr>
<th>Percentages:
<td>N/A
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed Value:
<td>specified value
</table>
<p> When the value of ‘<a href="#list-style-image"><code
class=property>list-style-image</code></a>’ is ‘<a
href="#list-style-type-none"><code class=css>none</code></a>’ or an <a
href="http://www.w3.org/TR/css3-images/#invalid-image">invalid image</a>,
the ‘<a href="#list-style-type"><code
class=property>list-style-type</code></a>’ property is used to construct
the default contents of a list item's marker; otherwise, ‘<a
href="#list-style-type"><code class=property>list-style-type</code></a>’
is ignored. The values are defined as follows:
<dl>
<dt><dfn id=list-style-type-string>&lt;string></dfn>
<dd> The <a href="#list-style-type-string"><code>&lt;string></code></a> is
used as the list item's marker's <a href="#default-contents"><i>default
contents</i></a>.
<dt><dfn
id=list-style-type-counter-style-name>&lt;counter-style-name></dfn>
<dd> If there is a counter style defined matching the <a
href="#list-style-type-counter-style-name"><code>&lt;counter-style-name></code></a>,
the list item's marker's <a href="#default-contents"><i>default
contents</i></a> are that counter style. [[CSS-COUNTER-STYLES]]
Otherwise, the list item's marker's <a
href="#default-contents& 1D74 quot;><i>default contents</i></a> are ‘<a
href="#list-style-type-none"><code class=css>none</code></a>’.
<dt><dfn id=list-style-type-symbols-function>&lt;symbols-function></dfn>
<dd> The list item's marker's <a href="#default-contents"><i>default
contents</i></a> are the counter style represented by the <a
href="#list-style-type-symbols-function"><code>&lt;symbols-function></code></a>.
[[CSS-COUNTER-STYLES]]
<dt><dfn id=list-style-type-none>none</dfn>
<dd> The list item's marker's <a href="#default-contents"><i>default
contents</i></a> are ‘<a href="#list-style-type-none"><code
class=css>none</code></a>’.
</dl>
<div class=example>
<p>The following examples illustrate how to set markers to various values:
<pre><!--
-->ul { list-style-type: "★"; }
<!--
-->/* Sets the marker to a "star" character */
<!--
-->
<!--
-->p.note {
<!--
--> display: list-item;
<!--
--> list-style-type: "Note: ";
<!--
--> list-style-position: inside;
<!--
-->}
<!--
-->/* Gives note paragraphs a marker consisting of the string "Note: " */
<!--
-->
<!--
-->ol { list-style-type: upper-roman; }
<!--
-->/* Sets all ordered lists to use the upper-roman counter-style
<!--
--> (defined in the Counter Styles specification [[CSS-COUNTER-STYLES]]) */
<!--
-->
<!--
-->ul { list-style-type: symbols(repeating '○' '●'); }
<!--
-->/* Sets all unordered list items to alternate between empty and
<!--
--> filled circles for their markers. */
<!--
-->
<!--
-->ul { list-style-type: none; }
<!--
-->/* Suppresses the marker entirely, unless list-style-image is specified
<!--
--> with a valid image, or the marker's contents are set explicitly via
<!--
--> the 'content' property. */</pre>
</div>
<!-- ====================================================================== -->
<h2 id=list-style-position-property><span class=secno>4. </span> Marker
Position: The ‘<a href="#list-style-position"><code
class=property>list-style-position</code></a>’ property</h2>
<table class=propdef>
<tbody>
<tr>
<th>Name:
<td><dfn id=list-style-position>list-style-position</dfn>
<tr>
<th>Value:
<td>inside | outside
<tr>
<th>Initial:
<td>outside
<tr>
<th>Applies To:
<td><a href="#list-item"><i title="list item">list items</i></a>
<tr>
<th>Inherited:
<td>yes
<tr>
<th>Percentages:
<td>N/A
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed Value:
<td>specified value (but see prose)
</table>
<p> This property helps control the position of the ‘<code
class=css>::marker</code>’ pseudo-element in the <a
href="#list-item"><i>list item</i></a>. The values are defined as follows:
<dl>
<dt><dfn id=list-style-position-inside>inside</dfn>
<dd> The ‘<code class=css>::marker</code>’ pseudo-element is an inline
element placed immediately before where the ‘<code
class=css>::before</code>’ pseudo-element would be placed in the <a
href="#list-item"><i>list item</i></a>.
<dt><dfn id=list-style-position-outside>outside</dfn>
<dd> As ‘<a href="#list-style-position-inside"><code
cla A8A6 ss=css>inside</code></a>’, plus the ‘<code
class=property>position</code>’ property on the marker computes to
‘<code class=css>marker</code>’. Additionally, the base
directionality of the marker (used as an input to the bidi resolution
algorithm) must be taken from the marker's <a
href="#marker-positioning-reference-element"><i>marker positioning
reference element</i></a>.
<p> If the <a href="#list-item"><i>list item</i></a> is ‘<code
class=css>display: inline-list-item</code>’, this value computes to
‘<a href="#list-style-position-inside"><code
class=css>inside</code></a>’.
</dl>
<p class=note> Note that a marker is only generated if the used value of
the ‘<code class=property>content</code>’ property for the ‘<code
class=css>::marker</code>’ pseudo-element is not ‘<a
href="#list-style-type-none"><code class=css>none</code></a>’.
<div class=example>
<p>For example:
<pre><!--
-->&lt;style>
<!--
--> ul.compact { list-style: inside; }
<!--
--> ul { list-style: outside; }
<!--
-->&lt;/style>
<!--
-->&lt;ul class=compact>
<!--
--> &lt;li>first "inside" list item comes first&lt;/li>
<!--
--> &lt;li>second "inside" list item comes first&lt;/li>
<!--
-->&lt;/ul>
<!--
-->&lt;hr>
<!--
-->&lt;ul>
<!--
--> &lt;li>first "outside" list item comes first&lt;/li>
<!--
--> &lt;li>second "outside" list item comes first&lt;/li>
<!--
-->&lt;/ul></pre>
<p>The above example may be formatted as:
<pre>
<!--
--> * first "inside" list
<!--
--> item comes first
<!--
--> * second "inside" list
<!--
--> item comes second
<!--
-->
<!--
-->========================
<!--
-->
<!--
-->* first "outside" list
<!--
--> item comes first
<!--
-->* second "outside" list
<!--
--> item comes second</pre>
</div>
<!-- ====================================================================== -->
<h2 id=list-style-property><span class=secno>5. </span> The ‘<a
href="#list-style"><code class=property>list-style</code></a>’ shorthand
property</h2>
<table class=propdef>
<tbody>
<tr>
<th>Name:
<td><dfn id=list-style>list-style</dfn>
<tr>
<th>Value:
<td>&lt;‘<a href="#list-style-type"><code
class=property>list-style-type</code></a>’> || &lt;‘<a
href="#list-style-position"><code
class=property>list-style-position</code></a>’> || &lt;‘<a
href="#list-style-image"><code
class=property>list-style-image</code></a>’>
<tr>
<th>Initial:
<td>see individual properties
<tr>
<th>Applies To:
<td><a href="#list-item"><i title="list item">list items</i></a>
<tr>
<th>Inherited:
<td>yes
<tr>
<th>Percentages:
<td>N/A
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed Value:
<td>see individual properties
</table>
<p> The ‘<a href="#list-style"><code
class=property>list-style</code></a>’ property is a shorthand notation
for setting the three properties ‘<a href="#list-style-type"><code
class=property>list-style-type</code></a>’, ‘<a
href="#list-style-image"><code
class=property>list-style-image</code></a>’, and ‘<a
href="#list-style-position"><code
class=property>list-style-position</code></a>’ at the same place in the
style sheet.
<div class=example>
<p> For example:
<pre>
<!--
-->UL { list-style: upper-roman inside } /* Any UL */
<!--
-->UL UL { list-style: circle outside } /* Any UL child of a UL */</pre>
</div>
<p> Using a value of ‘<a href="#list-style-type-none"><code
class=css>none</code></a>’ in the shorthand is potentially ambiguous, as
‘<a href="#list-style-type-none"><code class=css>none</code></a>’ is a
valid value for both ‘<a href="#list-style-image"><code
class=property>list-style-image</code></a>’ and ‘<a
href="#list-style-type"><code
class=property>list-style-type</code></a>’. To resolve this ambiguity, a
value of ‘<a href="#list-style-type-none"><code
class=css>none</code></a>’ in the shorthand must be applied to whichever
of the two properties aren't otherwise set by the shorthand.
<div class=example>
<pre><!--
-->list-style: none disc;
<!--
-->/* Sets the image to "none" and the type to "disc". */
<!--
-->
<!--
-->list-style: none url(bullet.png);
<!--
-->/* Sets the image to "url(bullet.png)" and the type to "none". */
<!--
-->
<!--
-->list-style: none;
<!--
-->/* Sets both image and type to "none". */
<!--
-->
<!--
-->list-style: none disc url(bullet.png);
<!--
-->/* Syntax error */</pre>
</div>
<div class=example>
<p> Although authors may specify ‘<a href="#list-style"><code
class=property>list-style</code></a>’ information directly on list item
elements (e.g., <code>&lt;li></code> in HTML), they should do so with
care. Consider the following rules:
<pre><!--
-->ol.alpha li { list-style: lower-alpha; }
<!--
-->ul li { list-style: disc; }</pre>
<p> The above won't work as expected. If you nest a <code>&lt;ul></code>
into an <code>&lt;ol class=alpha></code>, the first rule's specificity
will make the <code>&lt;ul></code>&apos;s list items use the lower-alpha
style.
<pre><!--
-->ol.alpha > li { list-style: lower-alpha; }
<!--
-->ul > li { list-style: disc; }</pre>
<p> These work as intended.
<pre><!--
-->ol.alpha { list-style: lower-alpha; }
<!--
-->ul { list-style: disc; }</pre>
<p> These are even better, since inheritance will transfer the ‘<a
href="#list-style"><code class=property>list-style</code></a>’ value to
the list items.
</div>
<!-- ====================================================================== -->
<h2 id=marker-pseudo-element><span class=secno>6. </span> Markers: The
‘<code class=css>::marker</code>’ pseudo-element</h2>
<p> This specification defines a new type of pseudo-element, the ‘<code
class=css>::marker</code>’ pseudo-element, which is generated by <a
href="#list-item"><i>list items</i></a> to represent the item's marker
(the bullet or number identifying each item).
<p> Like ‘<code class=css>::before</code>’ and ‘<code
class=css>::after</code>’, the ‘<code class=css>::marker</code>’
pseudo-element can be styled with the full range of CSS properties and
values, exactly like a real element. Markers are placed at the beginning
of their superior parent's content, before the ‘<code
class=css>::before</code>’ pseudo-element (if it exists). ‘<code
class=css>::marker</code>’ pseudo-elements are inline by default, though
certain values for ‘<a href="#list-style-position"><code
class=property>list-style-position</code></a>’ on the list item can make
the marker box positioned, which can have an effect on the computed value
of display.
<p> The ‘<code class=css>::marker</code>’ pseudo-element is only
created on <a href="#list-item"><i>list items</i></a>. On any other
element, the ‘<code class=css>::marker</code>’ pseudo-element's
‘<code class=property>content</code>’ property must compute to ‘<a
href="#list-style-type-none"><code class=css>none</code></a>’, which
suppresses its creation.
<div class=example>
<p> In the following example, the content is centered within a marker box
of a fixed width. This document:
<pre><!--
-->&lt;style>
<!--
-->li::marker {
<!--
--> content: "(" counter(counter) ")";
<!--
--> width: 6em;
<!--
--> text-align: center;
<!--
-->}
<!--
-->li {
<!--
--> display: list-item;
<!--
--> counter-increment: counter;
<!--
-->}
<!--
-->&lt;/style>
<!--
-->&lt;ol>
<!--
--> &lt;li>This is the first item.&lt;/li>
<!--
--> &lt;li>This is the second item.&lt;/li>
<!--
--> &lt;li>This is the third item.&lt;/li>
<!--
-->&lt;/ol></pre>
<p> should render something like this:
<pre><!--
--> (1) This is the
<!--
--> first item.
<!--
--> (2) This is the
<!--
--> second item.
<!--
--> (3) This is the
<!--
--> third item.</pre>
</div>
<div class=example>
<p>In this example, markers are used to number paragraphs that are
designated as "notes":
<pre><!--
-->&lt;style>
<!--
-->p { margin-left: 12 em; }
<!--
-->p.note {
<!--
--> display: list-item;
<!--
--> counter-increment: note-counter;
<!--
-->}
<!--
-->p.note::marker {
<!--
--> content: "Note " counter(note-counter) ":";
<!--
--> text-align: left;
<!--