How to add visual effects to images with CSS?

Learn, how can we add visual effects to images with CSS?
Submitted by Apurva Mathur, on August 03, 2022

Appearance is one of the most important aspects of a website. Visual appeal is what meets the eye. It's the colors, shapes, pictures, fonts, white space, and overall visual balance of a design. Whether a website appeal to us affects how we perceive it, how we use it, and how we remember it.

Appearance says a lot about your website that is the one thing that attracts the attention of the audience. This is key to getting visitors engaged with your website. We like to look at pretty things and if we have the choice, we always prefer an attractive design or image over an ugly or neutral one.

Adding visual effects to a normal image can also attract the audience, if used correctly and we can easily add visual effects to any image using the filter property, filter property has many values, and one of the values is inverted. Invert is reversing the color of an image or video. When referring to an image, this is often called a negative. This value adds visual effects to the images.


filter:invert (value %)

The maximum value of this property is 100%; this will perfectly add visual effects to an image. You can reduce the value and see the changes accordingly.

HTML and CSS code to add visual effects to images

<!DOCTYPE html>
    <meta name="viewport" content="width=device-width, initial-scale=1">
      margin: 20px;
      width: 600px;
      height: 500px;
      img.invert {
      width: 600px;
      height: 500px;
        <h1>Orignal Image VS Invert filter property</h1>
      <img class="normal" src="">
      <img class="invert" src="">


Example: Add visual effects to images

CSS Tutorial & Examples »

Comments and Discussions!

Copyright © 2023 All rights reserved.