How to add visual effects to images with CSS?

CSSWeb DevelopmentFront End Technology

Following is the code to add visual effects to images with CSS −

Example

 Live Demo

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
img{
   margin: 20px;
}
img.normal{
   margin-left: 30%;
   width: 300px;
   height: 300px;
}
img.filter {
   width: 300px;
   height: 300px;
   filter: invert(100%);
}
</style>
</head>
<body>
<h1 style="text-align: center;">CSS Image effects 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 06-Apr-2020 16:05:09
Advertisements