Set all but one element to dim background - HTML CSS CSS Property

HTML CSS examples for CSS Property:background

Description

Set all but one element to dim background

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 {<!--  ww  w  .j  av  a  2 s.c  om-->
   background: #f00;
   width: 100px;
   height: 100px;
   display: inline-block;
   margin: 10px;
}
.item.selected {
   position: relative;
   z-index: 200
}
.blanket {
   position: absolute;
   left: 0;
   top: 0;
   width: 100%;
   height: 100%;
   background: black;
   opacity: 0.5;
   z-index: 100;
}


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

Related Tutorials