force a li item to be 100% of the parent container's width - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:UL Element

Description

force a li item to be 100% of the parent container's width

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">
li {<!--from   w  ww. ja  va 2  s .c  om-->
   background-color:Chartreuse;
   border:2px solid yellow;
   padding:4px;
   margin:4px 4px;
}

ul {
   width:301px;
   padding:4px;
   background-color:blue;
   border:2px solid pink;
}
</style> 
 </head> 
 <body> 
  <div> 
   <ul> 
    <li>Lorem ips</li> 
    <li>Lorem ips</li> 
    <li>Lorem ips</li> 
    <ul> 
     <li>Lorem ips</li> 
     <li>Lorem ips</li> 
     <li>Lorem ips</li> 
     <li>Lorem ips</li> 
     <li>Lorem ips</li> 
     <li>Lorem ips</li> 
     <li>Lorem ips</li> 
    </ul> 
    <li>Lorem ips</li> 
    <li>Lorem ips</li> 
    <li>Lorem ips</li> 
    <li>Lorem ips</li> 
   </ul> 
  </div>  
 </body>
</html>

Related Tutorials