<!DOCTYPE html>
<html>
<head>
<style>
p:nth-of-type(odd) {
background: red;
}
p:nth-of-type(even) {
background: blue;
</style>
</head>
<body>
<h1>nth-of-type() 演示</h1>
<p>第一个段落。</p>
<p>第二个段落。</p>
<p>第三个段落。</p>
</body>
</html>