Skip to content

Commit 6f25d04

Browse files
committed
1 parent 85cee27 commit 6f25d04

2 files changed

Lines changed: 96 additions & 2 deletions

File tree

css3-values/Overview.html

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,10 @@ <h2 class="no-num no-toc" id=contents>Table of contents</h2>
273273
class=css>min()</code>&rsquo; and &lsquo;<code
274274
class=css>max()</code>&rsquo; </a>
275275

276-
<li><a href="#attr"><span class=secno>9.2. </span> Attribute References:
276+
<li><a href="#cycle"><span class=secno>9.2. </span> Cycling Values:
277+
&lsquo;<code class=css>cycle()</code>&rsquo;</a>
278+
279+
<li><a href="#attr"><span class=secno>9.3. </span> Attribute References:
277280
&lsquo;<code class=css>attr()</code>&rsquo;</a>
278281
</ul>
279282

@@ -1409,7 +1412,55 @@ <h3 id=calc><span class=secno>9.1. </span> Calculations: &lsquo;<a
14091412
both auto and fixed layout tables may be treated as if &lsquo;<code
14101413
class=property>auto</code>&rsquo; had been specified.
14111414

1412-
<h3 id=attr><span class=secno>9.2. </span> Attribute References:
1415+
<h3 id=cycle><span class=secno>9.2. </span> Cycling Values: &lsquo;<code
1416+
class=css>cycle()</code>&rsquo;</h3>
1417+
1418+
<p>The <dfn id=cycle0>&lsquo;<code class=css>cycle()</code>&rsquo;</dfn>
1419+
expression allows descendant elements to cycle over a list of values
1420+
instead of inheriting the same value. The syntax of the &lsquo;<code
1421+
class=css>cycle()</code>&rsquo; expression is:
1422+
1423+
<pre>cycle( &lt;value&gt;# )</pre>
1424+
1425+
<p>where <code>&lt;value&lt;</code> is a CSS value that is valid where
1426+
the expression is placed. If any of the values inside are not valid,
1427+
then the entire &lsquo;<code class=css>cycle()</code>&rsquo; expression
1428+
is invalid.
1429+
1430+
<p>The value returned by &lsquo;<code class=css>cycle()</code>&rsquo;
1431+
must be determined by comparing the inherited value <var>I</var> (the
1432+
computed value on the parent, or, for the root, the initial value) to
1433+
the computed values <var>C<sub>n</sub></var> returned by the
1434+
<var>n</var>-th argument to &lsquo;<code
1435+
class=css>cycle()</code>&rsquo;. For the earliest
1436+
<var>C<sub>n</sub></var> such that <var>C<sub>n</sub></var> ==
1437+
<var>I</var>, the value returned by cycle is <var>C<sub>n+1</sub></var>.
1438+
However, if this <var>C<sub>n</sub></var> is the last value, or if there
1439+
are no <var>C<sub>n</sub></var> that equal <var>I</var>, the computed
1440+
value of the first value is returned instead.
1441+
1442+
<pre class=example>
1443+
/* make em elements italic, but make them normal if they're inside
1444+
something that's italic */
1445+
em { font-style: cycle(italic, normal); }</pre>
1446+
1447+
<pre class=example>
1448+
/* cycle between markers for nested lists, so that the top level has
1449+
disk markers, but nested lists use circle, square, box, and then
1450+
(for the 5th list deep) repeat */
1451+
ul { list-style-type: disk; }
1452+
li > ul { list-style-type: cycle(disk, circle, square, box); }</pre>
1453+
1454+
<p>The &lsquo;<code class=css>cycle()</code>&rsquo; notation is not
1455+
allowed to be nested; nor may it contain &lsquo;<code
1456+
class=css>attr()</code>&rsquo;, &lsquo;<a href="#calc0"><code
1457+
class=css>calc()</code></a>&rsquo;, &lsquo;<a href="#min"><code
1458+
class=css>min()</code></a>&rsquo;, or &lsquo;<a href="#max"><code
1459+
class=css>max()</code></a>&rsquo; notations. Declarations containing
1460+
such constructs are invalid and must be <a
1461+
href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>.
1462+
1463+
<h3 id=attr><span class=secno>9.3. </span> Attribute References:
14131464
&lsquo;<code class=css>attr()</code>&rsquo;</h3>
14141465

14151466
<p class=issue>Describe the feature fully here, not just a delta from CSS
@@ -2085,6 +2136,9 @@ <h2 class=no-num id=index>Index</h2>
20852136
<li>computed value, <a href="#computed-value" title="computed
20862137
value"><strong>10.2.</strong></a>
20872138

2139+
<li>&lsquo;<code class=css>cycle()</code>&rsquo;, <a href="#cycle0"
2140+
title="''cycle()''"><strong>9.2.</strong></a>
2141+
20882142
<li>deg, <a href="#deg" title=deg><strong>6.1.</strong></a>
20892143

20902144
<li>dimension, <a href="#dimension"

css3-values/Overview.src.html

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,47 @@ <h3 id="calc">
982982
table cells in both auto and fixed layout tables may be treated as if
983983
'auto' had been specified.
984984

985+
<h3 id="cycle">
986+
Cycling Values: ''cycle()''</h3>
987+
988+
<p>The <dfn>''cycle()''</dfn> expression allows descendant elements
989+
to cycle over a list of values instead of inheriting the same value.
990+
The syntax of the ''cycle()'' expression is:
991+
992+
<pre>cycle( &lt;value&gt;# )</pre>
993+
994+
<p>where <code>&lt;value&lt;</code> is a CSS value that is valid where
995+
the expression is placed. If any of the values inside are not valid,
996+
then the entire ''cycle()'' expression is invalid.
997+
998+
<p>The value returned by ''cycle()'' must be determined by comparing
999+
the inherited value <var>I</var> (the computed value on the parent,
1000+
or, for the root, the initial value) to the computed values
1001+
<var>C<sub>n</sub></var> returned by the <var>n</var>-th argument to
1002+
''cycle()''.
1003+
For the earliest <var>C<sub>n</sub></var> such that
1004+
<var>C<sub>n</sub></var> == <var>I</var>, the value returned by cycle
1005+
is <var>C<sub>n+1</sub></var>. However, if this <var>C<sub>n</sub></var>
1006+
is the last value, or if there are no <var>C<sub>n</sub></var> that
1007+
equal <var>I</var>, the computed value of the first value is returned
1008+
instead.
9851009

1010+
<pre class="example">
1011+
/* make em elements italic, but make them normal if they're inside
1012+
something that's italic */
1013+
em { font-style: cycle(italic, normal); }</pre>
1014+
1015+
<pre class="example">
1016+
/* cycle between markers for nested lists, so that the top level has
1017+
disk markers, but nested lists use circle, square, box, and then
1018+
(for the 5th list deep) repeat */
1019+
ul { list-style-type: disk; }
1020+
li > ul { list-style-type: cycle(disk, circle, square, box); }</pre>
1021+
1022+
<p>The ''cycle()'' notation is not allowed to be nested; nor may it
1023+
contain ''attr()'', ''calc()'', ''min()'', or ''max()'' notations.
1024+
Declarations containing such constructs are invalid and must be
1025+
<a href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>.
9861026

9871027
<h3 id="attr">
9881028
Attribute References: ''attr()''</h3>

0 commit comments

Comments
 (0)