overlap two absolutely positioned elements - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Absolute Position

Description

overlap two absolutely positioned elements

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">
div.btn {<!--from w  ww . ja v  a2 s.c o  m-->
   width:100px;
   height:100px;
   float:left;
   border:2px solid Chartreuse;
   font-family:Arial, Helvetica, sans-serif;
   font-size:81px;
   text-align:center;
   position:relative;
}

div.vertical_line {
   width:0;
   height:100px;
   border:2px solid yellow;
   position:absolute;
   right:51px;
   z-index:100;
   margin:0;
   padding:0;
}

div.btn span {
   position:relative;
   z-index:0;
}
</style> 
 </head> 
 <body> 
  <div class="btn"> 
   <div class="vertical_line"></div> 
   <span>L</span> 
  </div>  
 </body>
</html>

Related Tutorials