Absolute position a div from left to the right using media queries - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Media

Description

Absolute position a div from left to the right using media queries

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">
body, html {
   height:100%;
   margin:0;
}

.container {<!--from  w  w w  .  jav a  2s  . co m-->
   height:100%;
   background:Chartreuse;
   position:relative;
}

.left {
   height:100%;
   width:201px;
   background:orange;
   position:absolute;
   left:0;
}

@media only screen and (max-width: 700px)  {
   .left {
      position:absolute;
      left:auto;
      right:0;
      background:lime;
   }

}
</style> 
 </head> 
 <body> 
  <div class="container"> 
   <div class="left"></div> 
  </div>  
 </body>
</html>

Related Tutorials