Add different background image for each LI : li background « Tags « HTML / CSS






Add different background image for each LI

    

<!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" xml:lang="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <style type="text/css" media="screen">
  #divID #recipe {
    list-style: none;
  }
  
  #divID #recipe li {
    padding: 10px 50px;
    margin-bottom: 6px;
    border-bottom: 1px solid #ccc;
  }
  
  #divID #one {
    background: url(img/ol_1.gif) no-repeat 6px 50%;
    }
  
  #divID #two {
    background: url(img/ol_2.gif) no-repeat 2px 50%;
    }
  
  #divID #three {
    background: url(img/ol_3.gif) no-repeat 3px 50%;
    }
  
  #divID #four {
    background: url(img/ol_4.gif) no-repeat 0px 50%;
    }
  
  #divID #five {
    background: url(img/ol_5.gif) no-repeat 6px 50%;
    }

  </style>
</head>

<body>


<div id="divID">
  <ol id="recipe">
    <li id="one">this is a test. </li>
    <li id="two">this is a test. </li>
    <li id="three">this is a test. </li>
    <li id="four">this is a test. </li> 
    <li id="five">this is a test. </li>
  </ol>
</div>



</body>
</html>

   
    
    
  








Related examples in the same category

1.LI background: url(search.gif) no-repeat;
2.Add list background image
3.li background: url(search_32.gif) no-repeat;
4.background for ul and li
5.Li background-image