Create multi-level lists with counter - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:UL Element

Description

Create multi-level lists with counter

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
ul.numeric {<!-- ww w  .j  a  v a2s  .  c o m-->
   counter-reset:section;
   list-style-type:none;
}

ul.numeric li {
   list-style-type:none;
}

ul.numeric li ul {
   counter-reset:subsection;
}

ul.numeric li:before {
   counter-increment:section;
   content:counter(section) ". ";
}

ul.numeric li ul li:before {
   counter-increment:subsection;
   content:counter(section) "." counter(subsection) " ";
}
</style> 
 </head> 
 <body> 
  <ul class="numeric"> 
   <li>Lorem i 
    <ul> 
     <li>Lorem i</li> 
     <li>Lorem i</li> 
    </ul> </li> 
   <li>Lorem ip 
    <ul> 
     <li>Lorem </li> 
     <li>Lorem </li> 
    </ul> </li> 
   <li>Lorem i 
    <ul> 
     <li>Lorem </li> 
     <li>Lorem </li> 
     <li>Lorem </li> 
     <li>Lorem </li> 
    </ul> </li> 
   <li>Lorem ip 
    <ul> 
     <li>Lorem </li> 
     <li>Lorem </li> 
    </ul> </li> 
   <li>Lore</li> 
  </ul>  
 </body>
</html>

Related Tutorials