×

Html & Html5

The World's best Software Development Study Portal

CSS Opacity


If we want to set any transparency for any element than we can use this opacity property of the CSS. Mostly it is used when we want to set any opacity or transparency for any image.
For Example:-

<!DOCTYPE html>

<html>

<head>

<style>

.transparency{

       opacity: 0.5;

}

</style>

</head>

<body>

<p> Before applying opacity property </p>

<img src="tajmahal.jpg" alt="normal Tajmahal" >

<p> After applying opacity property.</p>

<img class="transparency" src="tajmahal.jpg" alt="transparent Tajmahal">

</body>

</html>

Output of the program


Before applying opacity property.

normal rose

After applying opacity property.

transparent rose

So this is how we can set the transparency for an element.







CSS 3 training insitute | Best IT Training classes in Gurgaon | Web Designing Training Institute