Click to See Complete Forum and Search --> : Target specific item in a list


NotionCommotion
01-20-2007, 02:49 AM
Can anyone let me know how I would target the third item in a list (i.e. page3)? Thanks

<div id="my_div">
<ul>
<li><a href="page1.html">Page 1</a></li>
<li><a href="page2.html">Page 2</a></li>
<li><a href="page3.html">Page 3</a></li>
<li><a href="page4.html">Page 4</a></li>
</ul>
</div>

Fang
01-20-2007, 04:16 AM
:nth-child() pseudo-class (http://www.w3.org/TR/2001/CR-css3-selectors-20011113/#nth-child-pseudo), unfortunately not supported yet.
Until then use class or id.

NotionCommotion
01-20-2007, 04:29 AM
Thanks Fang, I tried the following, and it seems to work.

<div id="my_div">
<ul>
<li><a href="page1.html" class="menu1">Page 1</a></li>
<li><a href="page2.html" class="menu2">Page 2</a></li>
<li><a href="page3.html" class="menu3">Page 3</a></li>
<li><a href="page4.html" class="menu4">Page 4</a></li>
</ul>
</div>

#my_div .menu1 {background: url(/i/rollover.gif) 0px -80px}