CSS3 Alternate Color Implementation Example

Source: Internet
Author: User

The code is as follows:




<head>


<meta http-equiv= "Content-type" content= "text/html"; Charset=utf-8 "/>


<title> Untitled Document </title>


<style type= "Text/css" >


#list1 Li:nth-of-type (odd) {background: #00ccff;} Odd Line


#list1 Li:nth-of-type (even) {background: #ffcc00;} Even line


#list2 Li:nth-child (4n+1) {background: #00ccff;} Use this style for every 4 (including fourth) starting from the first line


#list00000 Li:nth-child (4n+2) {background: #090;} Use secondary styles for every 4 (including fourth) starting from the second line


#list00000 Li:nth-child (4n+3) {background: #009;} Use secondary styles for every 4 (including fourth) starting from the third line


#list00000 Li:nth-child (4n+4) {background: #990;} Use secondary styles for every 4 (including fourth) starting from line fourth


</style>


</head>


<body>


<div>


<ul id= "List1" >


<li>1111111 Front Road is the lazy people to build a station multiplayer blog </li>


<LI>222222222222CSS3 interlaced color test </li>


<li>333333333 provides a jquery tutorial instance learning Code, a HTML5 tutorial instance, and a CSS/CSS3 tutorial instance learning code. </li>


<li>44444444 the soul of the blog on the front end of the road: learning, discovering, sharing, communicating </li>


<li>55555555555555</li>


<li>66666666666666666</li>


</ul>


<hr/>


<ul id= "List2" >


<li>1111111 Front Road is the lazy people to build a station multiplayer blog </li>


<LI>222222222222CSS3 interlaced color test </li>


<li>333333333 provides a jquery tutorial instance learning Code, a HTML5 tutorial instance, and a CSS/CSS3 tutorial instance learning code. </li>


<li>44444444 the soul of the blog on the front end of the road: learning, discovering, sharing, communicating </li>


<li>55555555555555</li>


<li>66666666666666666</li>


</ul>


</div>


</body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.