Working with CSS3 Filter Effects

CSSWeb DevelopmentFront End Technology

To set Filter Effects in CSS3, use the filter property. Following filter effects can be set −

blur() | brightness() | contrast() | grayscale() | invert() | opacity() | saturate() | url();

Following is the code for using filter effects in CSS3 −

Example

 Live Demo

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
img{
   margin: 20px;
   width: 200px;
   height: 200px;
}
img.normal{
   margin-left: 30%;
}
img.filter {
   filter: invert(100%);
}
</style>
</head>
<body>
<h1 style="text-align: center;">CSS3 Filter effect example</h1>
<img class="normal" src="https://i.picsum.photos/id/237/536/354.jpg">
<img class="filter" src="https://i.picsum.photos/id/237/536/354.jpg">
</body>
</html>

Output

The above code will produce the following output −

raja
Published on 11-May-2020 12:40:37
Advertisements