Z-index on absolutely and static positioned element element - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Absolute Position

Description

Z-index on absolutely and static positioned element element

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">
h3.line {<!--from ww w  . j  a  v  a2s  .  c  o  m-->
   font-size:25px;
   display:block;
   font-weight:301;
   text-align:center;
   margin:31px;
   position:relative;
   z-index:-2;
}

h3.line:after {
   content:'';
   position:absolute;
   left:0;
   top:16px;
   width:100%;
   height:2px;
   background-color:Chartreuse;
}

h3.line>span {
   background-color:yellow;
   padding:11px 21px;
   position:relative;
   z-index:2;
}
</style> 
 </head> 
 <body> 
  <h3 class="line"> <span>Lorem ipsum</span> </h3>  
 </body>
</html>

Related Tutorials