Styling ul tags. Numbered lists - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:UL Element

Description

Styling ul tags. Numbered lists

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">
body {<!--   w ww. j  a va  2  s. co  m-->
   counter-reset:listCounter;
}

ul {
   list-style:none;
}

ul>li:nth-child(odd):before {
   content:counter(listCounter)': ';
}

ul>li:nth-child(even):before {
   content:'A: ';
}

li {
   margin:21px 0;
}

li:nth-child(odd) {
   counter-increment:listCounter;
}
</style> 
 </head> 
 <body> 
  <ul> 
   <li>Lorem ip</li> 
   <li>Lorem </li> 
   <li>Lorem ip</li> 
   <li>Lorem </li> 
   <li>Lorem ip</li> 
   <li>Lorem </li> 
   <ul> 
   </ul> 
  </ul>  
 </body>
</html>

Related Tutorials