how can i select first second or third element with given class name using CSS?
Posted
by Tumharyyaaden
on Stack Overflow
See other posts from Stack Overflow
or by Tumharyyaaden
Published on 2010-05-01T18:40:05Z
Indexed on
2010/05/01
18:47 UTC
Read the original article
Hit count: 442
ie. i have the following:
<div class="myclass">my text1</div>
some other code+containers...
<div class="myclass">my text2</div>
some other code+containers...
<div class="myclass">my text3</div>
some other code+containers...
i have the css class div.myclass {doing things} that applies to all obviously but i also wanted to be able to select the first, second or third like this:
div.myclass:first {color:#000;}
div.myclass:second {color:#FFF;}
div.myclass:third {color:#006;}
almost like the jQuery index selection .eq( index ) which is what i am using currently but need a noscript alternative. Thanks in advance!
© Stack Overflow or respective owner