Stretch Flex layout - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex

Description

Stretch Flex layout

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>Flex Iframe</title> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
body {<!--from  w w w  . j a  va 2s .co m-->
   display:flex;
   flex-direction:column;
   margin:0;
   height:100vh;
}

header {
   background:yellow;
}

main {
   display:flex;
   flex:2;
}

span {
   background:green;
   display:inline-block;
}

div {
   display:flex;
   flex-direction:column;
   background:gray;
}

iframe {
   background:tan;
   flex:2;
}
</style> 
 </head> 
 <body> 
  <header>
    Some text 
  </header> 
  <main> 
   <span>Hello, world!</span> 
   <div> 
    <iframe></iframe> 
   </div> 
  </main>  
 </body>
</html>

Related Tutorials