Switching orientation of flex container for responsive layout - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Responsive

Description

Switching orientation of flex container for responsive layout

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">

.home-post-container {<!--  w w  w. jav  a2 s.  c om-->
   display: flex;
   padding: 1vw;
}
.home-post-thumb {
   flex: 1;
   margin: auto;
   border: 1px solid red;
}
.home-post-content {
   flex:3;
   border: 1px solid red;
}
@media (max-width: 400px) {
   .home-post-container {
      flex-direction: column;
   }
}


      </style> 
 </head> 
 <body> 
  <article class="home-post-container"> 
   <div class="home-post-thumb">
     POST THUMBNAIL 
   </div> 
   <div class="home-post-content"> 
    <h4 class="post-title">POST TITLE</h4> POST CONTENT 
   </div> 
  </article>  
 </body>
</html>

Related Tutorials