Style an ordered list so the number appears left-aligned and above the item - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:UL Alignment

Description

Style an ordered list so the number appears left-aligned and above the item

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">
ol {<!--from w w  w.ja  va 2 s .  co  m-->
   list-style:none;
   counter-reset:item;
}

ol li {
   counter-increment:item;
}

ol li:before {
   content:counter(item);
   display:block;
}
</style> 
 </head> 
 <body> 
  <ol> 
   <li>Lorem ip</li> 
   <li>Lorem ip</li> 
   <li>Lorem ipsu</li> 
  </ol>  
 </body>
</html>

Related Tutorials