Have a child Div cover portion of parent div's border - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Div Border

Description

Have a child Div cover portion of parent div's 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">

.outerBorder {<!--  w ww.ja  v  a 2 s .com-->
   border: 2px solid black;
}
.innerNoBorder {
   border-left:none;
   border-right:none;
   position:relative;
}
.innerNoBorder:after {
   position: absolute;
   top: -50%;
   left: -2px;
   bottom: -50%;
   border: 1px solid white;
   z-index: 45478;
   content:"";
}


      </style> 
 </head> 
 <body> 
  <div class="outerBorder"> 
   <div class="inner">
     hello 
   </div> 
   <div class="innerNoBorder">
     world 
   </div> 
   <div class="inner">
     test
   </div> 
  </div>  
 </body>
</html>

Related Tutorials