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
Release: 2017-04-02 10:52:21
Original
1944 people have browsed it

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>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template