Styling only parent list - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:UL Element

Description

Styling only parent list

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>ol>li {
   font-weight:bold;
   font-size:21px;
}

body>ol>li:first-child {
   color:Chartreuse;
}

body>ol>li:first-child>ol {
   color:yellow;
}

ol {<!--  ww  w.  j  a  va  2 s. c o m-->
   counter-reset:item;
}

li {
   display:block
}

li:before {
   content:counters(item, ".") ". ";
   counter-increment:item
}
</style> 
 </head> 
 <body> 
  <ol> 
   <li> <span>Lorem</span> 
    <ol> 
     <li>Lore</li> 
     <li>Lore</li> 
    </ol> </li> 
  </ol>  
 </body>
</html>

Related Tutorials