We all understand how much time consumed in converting an image into grayscale using Photoshop or making a sprite image which toggles on hover from grayscale to color and vice versa and adjusting saturation, or applying correct filters and blurring images etc.
Imagine what it will mean to you using CSS filter and saving the precious time to focus on development.
Using filters, we may drop few images count and speed up the load time of our webages. We can save time and focus on other UI task by using css filters.
So, here is the basics - with CSS filters we can do all those extensive time taking task easily wether its images, DOM elements and even videos. We can easily blur, turn an image into grayscale, set hue, saturation and contrast, and invert etc. with few lines of CSS code without using Photoshop.
So the question is how we can do it?
Well before start applying filters, let's see all the available options -
- hue-rotate() and
So what is the syntax ?
It is easy -
filter: <filter-function> [<filter-function>];
example - filter: grayscale(100%);
But there’s more to learn.
Let's have few practical examples to better understand the procees.
-webkit-filter: drop-shadow(8px 8px 5px #000);
filter: drop-shadow(8px 8px 5px #000);
Want to know the best part?
We can combine multiple CSS filters altogether and render desired visual. All the filter functions are separated by space and that is all. Easy enough.