Background color stretching with media query - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Media

Description

Background color stretching with media query

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">
* {<!--   w ww .j  a  va2  s .  c  o m-->
   box-sizing:border-box;
}

.row {
   background-color:Chartreuse;
}

.row h3 {
   background-color:yellow;
}

.left {
   width:26%;
   float:left;
   color:blue;
   padding:0 11px 0 11px;
}

.right {
   width:26%;
   float:right;
   color:pink;
   padding:0 11px 0 11px;
}

.center {
   width:51%;
   float:left;
   border-left:3px solid OrangeRed;
   border-right:3px solid grey;
}

.clear {
   clear:both;
}

@media (max-width: 1023px) and (min-width: 768px)  {
   .left {
      float:left;
      width:51%;
   }
   
   .right {
      float:left;
      width:51%;
   }
   
   .center {
      float:none;
      width:100%;
      clear:both;
   }

}
</style> 
 </head> 
 <body> 
  <div class="row"> 
   <div class="left">
     Lorem ips 
   </div> 
   <div class="right">
     Lorem ips 
   </div> 
   <div class="center"> 
    <h3>Lorem i</h3> 
   </div> 
   <div class="clear"></div> 
  </div>  
 </body>
</html>

Related Tutorials