Source Code: (back to article)
<!DOCTYPE html>
<html>
<head>
<title>Titre du document</title>
<style>
p:nth-last-of-type(odd) {
background: #1c87c9;
color:#eeeeee;
}
p:nth-last-child(even) {
background: #666666;
color:#eeeeee;
}
</style>
</head>
<body>
<h2>Exemple du sélecteur :nth-last-of-type </h2>
<p>Paragraphe 1</p>
<p>Paragraphe 2</p>
<p>Paragraphe 3</p>
<p>Paragraphe 4</p>
<p>Paragraphe 5</p>
<p>Paragraphe 6</p>
</body>
</html>