Have child item fill parent in flexbox - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Item

Description

Have child item fill parent in flexbox

Demo Code

ResultView the demo in separate window

<html lang="en">
 <head> 
  <title>  Obsidian Age</title> 
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> 
  <style>

body, html {
   background: skyblue;
   padding: 0;
   margin: 0;
}
.nav {<!--from  www.j av a  2s. co m-->
   background-color: salmon;
   height: 40px;
}
.nav ul {
   display: flex;
   align-items: center;
   height: 100%;
}
.nav ul > li {
   list-style: none;
   background: black;
   flex: 1;
   height: 100%;
}


      </style> 
 </head> 
 <body translate="no"> 
  <div class="nav"> 
   <ul> 
    <li> <a href="#">Link</a> </li> 
    <li> <a href="#">Link</a> </li> 
    <li> <a href="#">Link</a> </li> 
    <li> <a href="#">Link</a> </li> 
    <li> <a href="#">Link</a> </li> 
   </ul> 
  </div>  
 </body>
</html>

Related Tutorials