Friday, 26 September 2014

CSS even and odd rules





<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
.listing
{
width:980px; margin:0 auto;
}

.listing ul
{
margin:0px; padding:0px; float:left; list-style:none; width:100%;
}

.listing ul li
{
float:none; width:100%; height:50px;
}

.listing ul li:nth-child(even) { background-color:#009900;}
.listing ul li:nth-child(odd) { background-color:#99CC00;}


</style>
</head>

<body>

<div class="listing">
  <ul>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
  </ul>
</div>


</body>
</html>

No comments:

Post a Comment