Responsive web design using layout shift - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

Responsive web design using layout shift

Demo Code

ResultView the demo in separate window

<html lang="en">
 <head> 
  <title>Lorem ipsum do</title> 
  <style>
.box {<!-- w  ww . j a  va  2  s .  c  o  m-->
   width:100%;
   min-height:151px;
}

.dark-blue {
   background-color:Chartreuse;
}

.light-blue {
   background-color:yellow;
}

.green {
   background-color:blue;
}

.red {
   background-color:pink;
}

@media screen and (min-width:500px) {
   .container {
      display:flex;
      flex-wrap:wrap;
   }
   
   #container2 {
      width:51%;
   }
   
   .dark-blue {
      width:51%;
   }

}
</style> 
 </head> 
 <body translate="no"> 
  <title>Lorem ipsum </title> 
  <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"> 
  <link type="text/css" rel="stylesheet" href="main.css"> 
  <div class="container"> 
   <div class="box dark-blue"></div> 
   <div class="container" id="container2"> 
    <div class="box light-blue"></div> 
    <div class="box green"></div> 
   </div> 
   <div class="box red"></div> 
  </div>  
 </body>
</html>

Related Tutorials