make all list items stretch to full width of a container - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:UL Element

Description

make all list items stretch to full width of a container

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">
nav {<!--from   ww w  .j  ava  2  s .com-->
   display:flex;
   border:2px solid Chartreuse;
   width:701px;
}

ul {
   display:flex;
   flex-grow:2;
   width:100%;
   padding:11px;
   list-style-type:none;
}

ul li {
   flex-grow:2;
   padding:26px;
   margin:11px;
   text-align:center;
   background:yellow;
   color:blue;
}
</style> 
 </head> 
 <body> 
  <nav> 
   <ul> 
    <li> <a href="#">L</a> </li> 
    <li> <a href="#">L</a> </li> 
    <li> <a href="#">L</a> </li> 
    <li> <a href="#">L</a> </li> 
    <li> <a href="#">L</a> </li> 
    <li> <a href="#">L</a> </li> 
   </ul> 
  </nav>  
 </body>
</html>

Related Tutorials