Adding border for two divs side-by-side - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Div Border

Description

Adding border for two divs side-by-side

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <style>

#a {<!--from  ww  w.  j  a  v  a 2  s. c o m-->
   border: 10px solid red;
   width: 200px;
   height: 200px;
   background: black;
   font-size: 0;
}
#a1 {
   font-size: 16px;
   border: 10px solid green;
   width: 100px;
   height: 200px;
   background: white;
   box-sizing: border-box;
   display: inline-block;
   float:left;
}
#a2 {
   font-size: 16px;
   border:  20px solid green;
   width: 100px;
   height: 200px;
   background: white;
   box-sizing: border-box;
   display: inline-block;
   float:left; 
}


      </style> 
 </head> 
 <body> 
  <div id="a"> 
   <div id="apadding"> 
    <div id="a1">
      a1 
    </div> 
    <div id="a2">
      a2 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials