Adjust div position with screensize with @media - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

Adjust div position with screensize with @media

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">
#left {
   background:Chartreuse;
   height:201px;
}

#right {
   overflow:hidden;
   background:yellow;
   height:201px;
}

@media all and (min-width:600px) {
   #left {
      float:left;
      width:181px;
   }<!--from   www .  j  a  va  2s .  c  o m-->
   
   #right {
      margin-left:181px;
   }

}
</style> 
 </head> 
 <body> 
  <div> 
   <div id="left">
     Nav 
   </div> 
   <div id="right">
     this is a test. this is a test, this is a test 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials