Posted by dorayme on 06/18/07 02:05
In article <4aldi.14835$RX.5294@newssvr11.news.prodigy.net>,
"Jon Slaughter" <Jon_Slaughter@Hotmail.com> wrote:
> "Jon Slaughter" <Jon_Slaughter@Hotmail.com> wrote in message
> news:T5ldi.14830$RX.9284@newssvr11.news.prodigy.net...
> > Is there any way to match the nth child in css < 3? Obviously I can do
> > first-child but I can't seem to get any other siblings ;/
> > I tried something .myclass:first-child + div
> >
> > for something like
> >
> > <div class="myclass">
> > <div>First child</div>
> > <div>Second child</div>
> > </div>
> >
> > but it doesn't work ;/
> >
> > Thanks,
> > Jon
> >
> >
>
> The main thing I need is a second-child like selector and not really an
> nth-child and I want to avoid having to specify the class of the the second
> div.
Try ol li:first-child + li {...}
I modify my last to include the idea:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<style type="text/css">
ol li:first-child {color: blue}
ol li:last-child {color: red}
ol li:first-child + li {color: yellow}
</style>
</head>
<body>
<ol>
<li>text</li>
<li>text</li>
<li>text</li>
<li>text</li>
</ol>
</body>
</html>
--
dorayme
Navigation:
[Reply to this message]
|