Fill the parent height using flexbox - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Height

Description

Fill the parent height using flexbox

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>flexbox fill parent height?</title> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">

.admonition {<!--  w ww.ja  v  a2 s  .  com-->
   border: 1px solid red;
   display: flex;
   justify-content: center;
   align-items: stretch;
}
.admonition > p {
   margin: 0;
   padding: 6px;
   display: block;
}
.admonition > .admonition-title {
   background-color: #2B83BD;
   color: #fff;
   display: block;
   padding: 2px;
   display: flex;
   align-items: center;
   justify-content: center;
}
.admonition > .admonition-title {
   font-size: 1px;
   letter-spacing: -1px;
   color: transparent;
   width: 64px;
   text-align: center;
   vertical-align: middle;
   min-width: 60px;
}
.admonition > .admonition-title:before {
   font-family: "FontAwesome";
   font-size: 32px;
   letter-spacing: normal;
   color: #fff;
}
.admonition.info > .admonition-title:before {
   content: "\f129";
}
.admonition.info > p:not(.admonition-title) {
   background-color: #7DBAE3;
}
.admonition.info > .admonition-title {
   background-color: #2B83BD;
}


      </style> 
 </head> 
 <body> 
  <div class="admonition info"> 
   <p class="admonition-title">Info</p> 
   <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> 
  </div>  
 </body>
</html>

Related Tutorials