mark up a layout blocks with the CSS property "display:flex;" - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Container

Description

mark up a layout blocks with the CSS property "display:flex;"

Demo Code

ResultView the demo in separate window

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

.container {<!--  www .  j a  v a  2  s. co m-->
   width:1100px;
   height:400px;
   -webkit-columns: 2;
}
figure {
   position:relative;
   width:300px;
   height:180px;
}
figure:first-child {
   width:600px;
   height:370px;
}
figure:first-child figcaption {
   width:590px;
}
figure figcaption {
   position:absolute;
   z-index:10;
   bottom:0;
   left:0;
   padding:5px;
   width:290px;
   background-color:rgba(0,0,0,.3);
}


      </style> 
 </head> 
 <body> 
  <div class="container"> 
   <figure> 
    <img src="https://www.java2s.com/style/demo/Opera.png" alt=""> 
    <figcaption>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 
    </figcaption> 
   </figure> 
   <figure> 
    <img src="https://www.java2s.com/style/demo/Google-Chrome.png" alt=""> 
    <figcaption>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 
    </figcaption> 
   </figure> 
   <figure> 
    <img src="https://www.java2s.com/style/demo/Opera.png" alt=""> 
    <figcaption>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 
    </figcaption> 
   </figure> 
  </div>  
 </body>
</html>

Related Tutorials