handle 'double opacity' of two overlapping divs - HTML CSS CSS Property

HTML CSS examples for CSS Property:opacity

Description

handle 'double opacity' of two overlapping divs

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">
body {<!--   w  w  w . j a v a2  s . c o  m-->
   background:url('https://www.java2s.com/style/demo/Google-Chrome.png') center center;
}

#outer {
   height:151px;
   width:251px;
   position:absolute;
   left:41%;
   top:21%;
   color:Chartreuse;
   font-size:27px;
}

#inner {
   width:100%;
   height:100%;
   position:absolute;
   left:0;
   top:0;
   z-index:-2;
   background:blue;
   opacity:0.7;
}

#inner:after {
   content:"";
   background:blue;
   height:41px;
   width:41px;
   border-radius:41px;
   position:absolute;
   top:-16px;
   left:-16px
}
</style> 
 </head> 
 <body> 
  <div id="outer"> 
   <div id="inner"></div> 
   <p>Lorem ipsum dolor sit amet, consectet</p> 
   <p>Lorem i</p> 
  </div>  
 </body>
</html>

Related Tutorials