Sizing html elements with borders - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Border Style

Description

Sizing html elements with borders

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">

.parent{<!--from  w  w w. jav a2  s  .  c  om-->
   overflow:hidden;
   width:800px;
}
.child{
   width:50%;
   float:left;
   background:red;
   border:2px solid green;
   box-sizing:border-box;
   -moz-box-sizing:border-box;
   -webkit-box-sizing:border-box;
}


      </style> 
 </head> 
 <body> 
  <div class="parent"> 
   <div class="child">
     50% 
   </div> 
   <div class="child">
     50% 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials