Adding filter gray effect to element - HTML CSS CSS Property

HTML CSS examples for CSS Property:filter

Description

Adding filter gray effect to 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">
.night-mode {<!--from   w  w  w .  j  a va  2s. c  o m-->
   -webkit-filter:grayscale(100%);
   filter:grayscale(100%);
   position:relative;
   display:block;
   background-color:Chartreuse;
   padding:51px;
}

.wrapper {
   background-color:yellow;
   height:501px;
}
</style> 
 </head> 
 <body> 
  <div class="night-mode"> 
   <div class="wrapper"> 
    <p>Make whole page to be in grayscale, including body margins.</p> 
    <p> <code>background-color</code> works for <code>html</code> , <code>filter</code> doesn't </p> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials