CSS media queries and div background color - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Media

Description

CSS media queries and div background color

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">
.image-full {<!--   ww w . j  a v  a 2s  .co m-->
   width:100px;
   height:100px;
   background-color:Chartreuse;
}

@media (max-width: 767px)  {
   .image-full {
      background-color:yellow;
   }
   
   body {
      background-color:blue;
   }

}

@media (min-width: 768px) and (max-width: 991px)  {
   .image-full {
      background-color:pink;
   }
   
   body {
      background-color:OrangeRed;
   }

}

@media (min-width: 992px) and (max-width: 1199px)  {
   .image-full {
      background-color:grey;
   }
   
   body {
      background-color:BlueViolet;
   }

}

@media (min-width: 1200px)  {
   .image-full {
      background-color:Chartreuse;
   }
   
   body {
      background-color:yellow;
   }

}
</style> 
 </head> 
 <body> 
  <div class="image-full"> 
  </div>  
 </body>
</html>

Related Tutorials