Home >Web Front-end >CSS Tutorial >Teach you how to use css3 to change colors between rows

Teach you how to use css3 to change colors between rows

PHPz
PHPzOriginal
2017-04-02 10:52:211932browse

How to achieve interlaced color change in css3? Use css3 selector p:nth-of-type(odd) odd and p:nth-of-type(even) even

The following are some examples:

<!DOCTYPE html>
<html>
<head>
<style> 
p:nth-of-type(odd)
{
background:#ff0000;
}
p:nth-of-type(even)
{
background:#0000ff;
}
</style>
</head>
<body>
 
<h1>This is a heading</h1>
<p>The first paragraph.</p>
<p>The second paragraph.</p>
<p>The third paragraph.</p>
 
</body>
</html>

Teach you how to use css3 to change colors between rows

The above is the detailed content of Teach you how to use css3 to change colors between rows. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn