Aligning divs with responsive design - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

Aligning divs with responsive design

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 {
   float:left;
   border:2px solid Chartreuse;
   width:calc(66% - 27px);
   border-radius:26px;
   background-color:yellow;
}

#right {
   border:2px solid blue;
   float:right;
   width:calc(36% - 41px);
   background-color:pink;
   padding-left:41px;
}

@media screen and (max-width: 500px)  {
   #left {
      display:block;
      width:100%;
   }<!--   ww  w  .  jav  a 2 s  .c o m-->
   
   #right {
      display:block;
      width:100%;
   }

}
</style> 
 </head> 
 <body> 
  <div id="right">
    Right 
  </div> 
  <div id="left">
    Left 
  </div>  
 </body>
</html>

Related Tutorials