Categories
CSS

How to invert colors of an image in CSS?

Spread the love

Sometimes, we want to invert colors of an image in CSS.

In this article, we’ll look at how to invert colors of an image in CSS.

How to invert colors of an image in CSS?

To invert colors of an image in CSS, we can use the invert CSS filter.

For instance, we write

<img src="https://picsum.photos/200/300" />

to add an image.

Then we write

img {
  -webkit-filter: invert(1);
  filter: invert(1);
}

to use the invert filter to invert the colors in an image.

Conclusion

To invert colors of an image in CSS, we can use the invert CSS filter.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.