2 divs have 1 border - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Div Border

Description

2 divs have 1 border

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

.item {<!--from  w  ww .  jav a  2 s . c om-->
   float:left;
   background: #ccc;
   width: 50px;
   height: 50px;
   border: 1px #000 solid;
   border-right-width: 0;
}
.item:last-child {
   border-right-width: 1px;
}
.item:hover {
   border: 1px #f00 solid;
}
.item:hover + .item {
   border-left-width: 0;
}


      </style> 
 </head> 
 <body> 
  <div class="item"></div> 
  <div class="item"></div> 
  <div class="item"></div> 
  <div class="item"></div>  
 </body>
</html>

Related Tutorials