/    /  CSS Opacity

CSS Opacity

 

The CSS opacity property is used to provide the transparency of an element.

The entire object and the opacity value is defined in terms of digital value less than 1. The lesser opacity value displays the greater opacity. Opacity is not inherited.

 

Example:

 

<!DOCTYPE html> 
<html> 
<head> 
<style> 
img.trans { 
  opacity: 0.4; 
  filter: alpha(opacity=40); /* For IE8 and earlier */ 
} 
</style> 
</head> 
<body> 
<p>Normal Image</p> 
<img src="good-morning.jpg" alt="normal"> 
<p>Transparent Image</p> 
<img class="trans" src="good-morning.jpg" alt="transparent"> 
</body> 
</html>

 

OUTPUT:

 

CSS Opacity