css实习三色交替背景
作者:互联网
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
p:nth-child(3n-2) {
background:#ff0000;
}
p:nth-child(3n-1) {
background:#0000ff;
}
p:nth-child(3n) {
background:green;
}
</style>
</head>
<body>
<p>x</p>
<p>x</p>
<p>x</p>
<p>x</p>
<p>x</p>
<p>x</p>
<p>x</p>
<p>x</p>
<p>x</p>
<p>x</p>
<p>x</p>
<p>x</p>
<p>x</p>
<p>x</p>
<p>x</p>
<p>x</p>
<p>x</p>
<p>x</p>
<p>x</p>
</body>
</html>
标签:nth,Title,交替,0000ff,3n,background,child,实习,css 来源: https://www.cnblogs.com/fly-book/p/16283275.html