Placing two div's with unequal width side by side - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Div

Description

Placing two div's with unequal width side by side

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 {<!--  www . ja v a  2 s. c om-->
   text-align: center;
}
.bodyRect {
   border: 1px solid black;
   -webkit-border-radius: 5px;
   -moz-border-radius: 5px;
   border-radius: 5px;
   padding: 10px;
   margin: 10px;
   -webkit-box-sizing: border-box;
   -moz-box-sizing: border-box;
   box-sizing: border-box;
}
#d1 {
   width: -webkit-calc(70% - 20px);
   width: -moz-calc(70% - 20px);
   width: calc(70% - 20px);
   float: left
}
#d2 {
   width: -webkit-calc(30% - 20px);
   width: -moz-calc(30% - 20px);
   width: calc(30% - 20px);
   float: right
}
.clearfix {
   display: block;
   clear: both;
   visibility: hidden;
   line-height: 0;
   height: 0;
}


      </style> 
 </head> 
 <body> 
  <div id="d1" class="bodyRect">
    div 1 
  </div> 
  <div id="d2" class="bodyRect">
    div 2 
  </div> 
  <span class="clearfix"></span>  
 </body>
</html>

Related Tutorials