×

Html & Html5

The World's best Software Development Study Portal

CSS3

Introduction to CSS


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>

img.transparency {

       opacity: 0.5;

       filter: alpha(opacity=40);

}

</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