You are here: Re: matching nth child « HTML « IT news, forums, messages
Re: matching nth child

Posted by dorayme on 06/18/07 01:54

In article <T5ldi.14830$RX.9284@newssvr11.news.prodigy.net>,
"Jon Slaughter" <Jon_Slaughter@Hotmail.com> 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
>
> <div class="myclass">
> <div>First child</div>
> <div>Second child</div>
> </div>
>
> 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:

<!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">
ul li:first-child {color: blue}
ul li:last-child {color: red}
</style>
</head>
<body>
<ul>
<li>text</li>
<li>text</li>
<li>text</li>
<li>text</li>
</ul>
</body>
</html>

Nice in FF.

--
dorayme

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация