Make Flexbox and vertical scroll in a full-height - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Height

Description

Make Flexbox and vertical scroll in a full-height

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">
html, body {
   height:100%;
}

#container {<!--from  w  w  w .ja v  a2 s  .  c o  m-->
   display:flex;
   flex-direction:column;
   height:100%;
   width:51%;
   background-color:Chartreuse;
}

#container header {
   background-color:yellow;
}

#container article {
   flex:2 2 auto;
   overflow-y:auto;
   min-height:0px;
}

#container footer {
   background-color:blue;
}
</style> 
 </head> 
 <body> 
  <section id="container"> 
   <header id="header">
     This is a header 
   </header> 
   <article id="content">
     This is the content that 
    <br> With a lot of lines. 
    <br> With a lot of lines. 
    <br> This is the content that 
    <br> With a lot of lines. 
    <br> 
    <br> This is the content that 
    <br> With a lot of lines. 
    <br> 
    <br> This is the content that 
    <br> With a lot of lines. 
    <br> 
   </article> 
   <footer id="footer">
     This is a footer 
   </footer> 
  </section>  
 </body>
</html>

Related Tutorials