<!DOCTYPE html>
<html>
<head>
<style>
p:nth-last-child(odd) {
background: red;
}
p:nth-last-child(even) {
background: blue;
</style>
</head>
<body>
<p>The first paragraph.</p>
<p>The second paragraph.</p>
<p>The third paragraph.</p>
</body>
</html>