blob: 8bb1c4a4b0d09b5dec965cc895919eb3ce464f06 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>:nth-child() pseudo-class</title>
<style type="text/css"><![CDATA[.green { background-color : lime ! important }
ul > li:nth-child(odd) { background-color : red }
ol > li:nth-child(even) { background-color : red }
table.t1 tr:nth-child(-n+4) { background-color : red }
table.t2 td:nth-child(3n+1) { background-color : red }]]></style>
<link rel="first" href="css3-modsel-1.xml" title="Groups of selectors"/>
<link rel="prev" href="css3-modsel-28.xml" title=":nth-child() pseudo-class"/>
<link rel="next" href="css3-modsel-29.xml" title=":nth-last-child() pseudo-class"/>
<link rel="last" href="css3-modsel-d4.xml" title="Dynamic updating of :first-child and :last-child"/>
<link rel="up" href="./index.html"/>
<link rel="top" href="../../index.html"/>
</head>
<body>
<ul>
<li class="green">This first list item should have a green background</li>
<li>Second list item</li>
<li class="green">This third list item should have a green background</li>
<li>Fourth list item</li>
<li class="green">This fifth list item should have a green background</li>
<li>Sixth list item</li>
</ul>
<ol>
<li>First list item</li>
<li class="green">This second list item should have a green background</li>
<li>Third list item</li>
<li class="green">This fourth list item should have a green background</li>
<li>Fifth list item</li>
<li class="green">This sixth list item should have a green background</li>
</ol>
<div>
<table border="1" class="t1">
<tr class="green">
<td>Green row : 1.1</td>
<td>1.2</td>
<td>1.3</td>
</tr>
<tr class="green">
<td>Green row : 2.1</td>
<td>2.2</td>
<td>2.3</td>
</tr>
<tr class="green">
<td>Green row : 3.1</td>
<td>3.2</td>
<td>3.3</td>
</tr>
<tr class="green">
<td>Green row : 4.1</td>
<td>4.2</td>
<td>4.3</td>
</tr>
<tr>
<td>5.1</td>
<td>5.2</td>
<td>5.3</td>
</tr>
<tr>
<td>6.1</td>
<td>6.2</td>
<td>6.3</td>
</tr>
</table>
<p></p>
<table class="t2" border="1">
<tr>
<td class="green">green cell</td>
<td>1.2</td>
<td>1.3</td>
<td class="green">green cell</td>
<td>1.5</td>
<td>1.6</td>
<td class="green">green cell</td>
<td>1.8</td>
</tr>
<tr>
<td class="green">green cell</td>
<td>2.2</td>
<td>2.3</td>
<td class="green">green cell</td>
<td>2.5</td>
<td>2.6</td>
<td class="green">green cell</td>
<td>2.8</td>
</tr>
<tr>
<td class="green">green cell</td>
<td>3.2</td>
<td>3.3</td>
<td class="green">green cell</td>
<td>3.5</td>
<td>3.6</td>
<td class="green">green cell</td>
<td>3.8</td>
</tr>
</table>
</div>
</body>
</html>