matching nth child
am 18.06.2007 03:20:51 von Jon Slaughter
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
but it doesn't work ;/
Thanks,
Jon
Re: matching nth child
am 18.06.2007 03:22:06 von Jon Slaughter
"Jon Slaughter" 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
>
>
>
First child
>
Second child
>
>
> but it doesn't work ;/
>
> Thanks,
> Jon
>
BTW, I know above int he example one could do
..myclass>div + div
but that is not what I'm looking for as its not very robust. (if I end up
adding a third child div then it screws up everything.
Re: matching nth child
am 18.06.2007 03:25:20 von Jon Slaughter
"Jon Slaughter" 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
>
>
>
First child
>
Second child
>
>
> 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.
Re: matching nth child
am 18.06.2007 03:38:39 von Jon Slaughter
"Jon Slaughter" 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
>
>
>
First child
>
Second child
>
>
> but it doesn't work ;/
>
> Thanks,
> Jon
>
>
Another this that I could do is first-child of first child but when I do
something like myclass:first-child:first-child it does not select the right
div.
basically doing it this way instead
But the selector doesn't get the second child ;/
Re: matching nth child
am 18.06.2007 03:54:02 von dorayme
In article ,
"Jon Slaughter" wrote:
> 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
>
>
>
First child
>
Second child
>
>
> but it doesn't work ;/
>
> Thanks,
> Jon
Last child works in some browsers. But why trust any of it, just
class things and be safe.
Try this in different browsers:
"http://www.w3.org/TR/html4/strict.dtd">
test
Nice in FF.
--
dorayme
Re: matching nth child
am 18.06.2007 04:05:09 von dorayme
In article <4aldi.14835$RX.5294@newssvr11.news.prodigy.net>,
"Jon Slaughter" wrote:
> "Jon Slaughter" 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
> >
> >
> >
First child
> >
Second child
> >
> >
> > 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:
"http://www.w3.org/TR/html4/strict.dtd">
test
- text
- text
- text
- text
--
dorayme