{"id":4909,"date":"2022-01-16T01:00:00","date_gmt":"2022-01-16T00:00:00","guid":{"rendered":"https:\/\/alvarotrigo.com\/epa\/css-image-filter\/"},"modified":"2025-06-04T09:53:41","modified_gmt":"2025-06-04T07:53:41","slug":"css-image-filter","status":"publish","type":"post","link":"https:\/\/alvarotrigo.com\/blog\/css-image-filter\/","title":{"rendered":"CSS Image Filter [Usage + 10 Examples]"},"content":{"rendered":"\n<p>Whether you run an <a href=\"https:\/\/alvarotrigo.com\/blog\/photography-portfolio-examples\/\">online portfolio<\/a>, a one-page website, or some <a href=\"https:\/\/alvarotrigo.com\/blog\/types-of-websites\/\">another type of website<\/a> which works with a lot of images, with a few lines of CSS, we can do an extremely surprising amount of image manipulation by adding image filters with CSS: changing brightness, altering colours, etc.<\/p>\n\n\n\n<p>You can actually do so much with CSS and you may not even realise it. In this article, I\u2019m sure you will be surprised by what you can do with images and pure CSS.<\/p>\n\n\n\n<p>A lot of the examples here rely on simple <strong>image filters (CSS)<\/strong> Luckily these are supported on all your modern browsers, but it is always important to test to make sure your use case works.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-the-filter-property%3F\">What is the <code>filter<\/code> property?<\/h2>\n\n\n\n<p><strong>The <code>filter<\/code> property provides us a way to modify the way an elements looks by adding certain effect to it. They are usually used in images, backgrounds and sometimes borders.<\/strong><\/p>\n\n\n\n<p>For example, we can apply a blur effect to an image, a black an white filter or change properties like contrast, saturation etc.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-apply-a-filter%3F\">How to apply a <code>filter<\/code>?<\/h2>\n\n\n\n<p>All we have to do is use the <strong><code>filter<\/code> CSS property<\/strong> and add the effect function and values for it.<\/p>\n\n\n\n<p>For example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-class\">.image-filter<\/span>{\n    <span class=\"hljs-attribute\">filter<\/span>: <span class=\"hljs-built_in\">hue-rotate<\/span>(<span class=\"hljs-number\">45deg<\/span>);\n}\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">img<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"image-fitler\"<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"my-image.jpg\"<\/span> <span class=\"hljs-attr\">alt<\/span>=<span class=\"hljs-string\">\"Image Filter\"<\/span> \/&gt;<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"interesting-image-filter---css-examples\">Interesting Image Filter &#8211; CSS Examples<\/h2>\n\n\n\n<p>Let\u2019s jump straight in shall we &#8211; Each example here will feature the original image on the left and the layered image on right, allowing you to compare the filter and its effect. Check out the CodePens to see how they are working as well.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1.-invert-image-filter\">1. Invert Image Filter<\/h3>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">filter<\/span>: <span class=\"hljs-selector-tag\">invert<\/span>(<span class=\"hljs-selector-attr\">&#91;&lt;number&gt; | &lt;percentage&gt;]<\/span>);\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Invert the colours of your images with this CSS image filter.<\/p>\n<\/blockquote>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_YzrdoaR\" data-src=\"\/\/codepen.io\/anon\/embed\/YzrdoaR?height=450&amp;theme-id=1&amp;slug-hash=YzrdoaR&amp;default-tab=css,result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed YzrdoaR\" title=\"CodePen Embed YzrdoaR\" class=\"cp_embed_iframe lazyload\" style=\"width:100%;overflow:hidden\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" data-load-mode=\"1\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/codepen.io\/alvarotrigo\/pen\/YzrdoaR\" title=\"Open CodePen\" target=\"_blank\" rel=\"noopener nofollow\">Open CodePen<\/a><\/div>\n<\/div>\n\n\n\n<p>The argument is the amount of conversion you want. You can specify a number or percentage. If you use percentage, a value of <code>100%<\/code> is completely inverted, while a value of <code>0%<\/code> leaves the input unchanged. All modern browsers support this filter.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"2.-grayscale-image-filter\">2. Grayscale Image Filter<\/h3>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">filter<\/span>: <span class=\"hljs-selector-tag\">grayscale<\/span>(<span class=\"hljs-selector-attr\">&#91;&lt;number&gt; | &lt;percentage&gt;]<\/span>);\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Convert your images to grayscale. Choose a percentage of colour to convert.<\/p>\n<\/blockquote>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_BawvgVa\" data-src=\"\/\/codepen.io\/anon\/embed\/BawvgVa?height=450&amp;theme-id=1&amp;slug-hash=BawvgVa&amp;default-tab=css,result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed BawvgVa\" title=\"CodePen Embed BawvgVa\" class=\"cp_embed_iframe lazyload\" style=\"width:100%;overflow:hidden\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" data-load-mode=\"1\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/codepen.io\/alvarotrigo\/pen\/BawvgVa\" title=\"Open CodePen\" target=\"_blank\" rel=\"noopener nofollow\">Open CodePen<\/a><\/div>\n<\/div>\n\n\n\n<p>Just specify a number or percentage, the default value is <code>1<\/code>. If you use percentage, a value of <code>100%<\/code> will show the image in grayscale, while a value of <code>0%<\/code> leaves the image like the original one. All modern browsers support this CSS image filter.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"3.-saturate-image-filter\">3. Saturate Image Filter<\/h3>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">filter<\/span>: <span class=\"hljs-selector-tag\">saturate<\/span>(<span class=\"hljs-selector-attr\">&#91;&lt;number&gt; | &lt;percentage&gt;]<\/span>);\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Use this image filter (CSS) to super-saturate or desaturate an image.<\/p>\n<\/blockquote>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_rNGoEZG\" data-src=\"\/\/codepen.io\/anon\/embed\/rNGoEZG?height=450&amp;theme-id=1&amp;slug-hash=rNGoEZG&amp;default-tab=css,result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed rNGoEZG\" title=\"CodePen Embed rNGoEZG\" class=\"cp_embed_iframe lazyload\" style=\"width:100%;overflow:hidden\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" data-load-mode=\"1\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/codepen.io\/alvarotrigo\/pen\/rNGoEZG\" title=\"Open CodePen\" target=\"_blank\" rel=\"noopener nofollow\">Open CodePen<\/a><\/div>\n<\/div>\n\n\n\n<p>The filter takes either a number or percentage. If you use a number, a value under &#8216;1&#8217; desaturates the image, while a vaule over <code>1<\/code> super-saturates it. In this case, I have used <code>8<\/code> to show an extreme effect. All modern browsers support this filter.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"4.-sepia-image-filter\">4. Sepia Image Filter<\/h3>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">filter<\/span>: <span class=\"hljs-selector-tag\">sepia<\/span>(<span class=\"hljs-selector-attr\">&#91;&lt;number&gt; | &lt;percentage&gt;]<\/span>);\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Use this image filter (CSS) to give the image a sepia tonality.<\/p>\n<\/blockquote>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_oNGJraa\" data-src=\"\/\/codepen.io\/anon\/embed\/oNGJraa?height=450&amp;theme-id=1&amp;slug-hash=oNGJraa&amp;default-tab=css,result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed oNGJraa\" title=\"CodePen Embed oNGJraa\" class=\"cp_embed_iframe lazyload\" style=\"width:100%;overflow:hidden\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" data-load-mode=\"1\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/codepen.io\/alvarotrigo\/pen\/oNGJraa\" title=\"Open CodePen\" target=\"_blank\" rel=\"noopener nofollow\">Open CodePen<\/a><\/div>\n<\/div>\n\n\n\n<p>This CSS image filter converts the image to give it a warmer, more yellow and brown look, depending on the original colours of the image itself. Specify either a number or percentage. In this case, I used a number. It must be between <code>0<\/code> and <code>1<\/code>. All modern browsers support this filter.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"5.-opacity-image-filter\">5. Opacity Image Filter<\/h3>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">filter<\/span>: <span class=\"hljs-selector-tag\">opacity<\/span>(<span class=\"hljs-selector-attr\">&#91;&lt;number&gt; | &lt;percentage&gt;]<\/span>);\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>This CSS image filter changes the transparency of an image.<\/p>\n<\/blockquote>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_QWqzXJE\" data-src=\"\/\/codepen.io\/anon\/embed\/QWqzXJE?height=450&amp;theme-id=1&amp;slug-hash=QWqzXJE&amp;default-tab=css,result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed QWqzXJE\" title=\"CodePen Embed QWqzXJE\" class=\"cp_embed_iframe lazyload\" style=\"width:100%;overflow:hidden\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" data-load-mode=\"1\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/codepen.io\/alvarotrigo\/pen\/QWqzXJE\" title=\"Open CodePen\" target=\"_blank\" rel=\"noopener nofollow\">Open CodePen<\/a><\/div>\n<\/div>\n\n\n\n<p>This function is also similar to the <code>opacity<\/code> CSS property but the difference with filters is some browsers will have hardware acceleration enabled for better performance. Again, you can use a number or percentage. I used <code>0.3<\/code>. You can use a value of <code>0.5<\/code> to set <code>50%<\/code> image transparency. This could be a good <strong>CSS background image filter<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"6.-brightness-image-filter\">6. Brightness Image Filter<\/h3>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">filter<\/span>: <span class=\"hljs-selector-tag\">brightness<\/span>(<span class=\"hljs-selector-attr\">&#91;&lt;number&gt; | &lt;percentage&gt;]<\/span>);\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Use this image filter (CSS) to make an image appear brighter or darker.<\/p>\n<\/blockquote>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_NWaeZex\" data-src=\"\/\/codepen.io\/anon\/embed\/NWaeZex?height=450&amp;theme-id=1&amp;slug-hash=NWaeZex&amp;default-tab=css,result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed NWaeZex\" title=\"CodePen Embed NWaeZex\" class=\"cp_embed_iframe lazyload\" style=\"width:100%;overflow:hidden\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" data-load-mode=\"1\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/codepen.io\/alvarotrigo\/pen\/NWaeZex\" title=\"Open CodePen\" target=\"_blank\" rel=\"noopener nofollow\">Open CodePen<\/a><\/div>\n<\/div>\n\n\n\n<p>It accepts a number or a percentage. The behaviour is a bit different from the previous filters. A value under <code>100%<\/code> or <code>1<\/code> darkens the image, while a value over <code>100%<\/code> or <code>1<\/code> brightens it. If you want almost a black image, set a value near <code>0%<\/code> (or <code>0<\/code>). All modern browsers support this filter. Also a good CSS filter for <strong>background images<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"7.-contrast-image-filter\">7. Contrast Image Filter<\/h3>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">filter<\/span>: <span class=\"hljs-selector-tag\">contrast<\/span>(<span class=\"hljs-selector-attr\">&#91;&lt;number&gt; | &lt;percentage&gt;]<\/span>);\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>This CSS image filter allows you to adjust the contrast of an image.<\/p>\n<\/blockquote>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_yLzGdZb\" data-src=\"\/\/codepen.io\/anon\/embed\/yLzGdZb?height=450&amp;theme-id=1&amp;slug-hash=yLzGdZb&amp;default-tab=css,result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed yLzGdZb\" title=\"CodePen Embed yLzGdZb\" class=\"cp_embed_iframe lazyload\" style=\"width:100%;overflow:hidden\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" data-load-mode=\"1\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/codepen.io\/alvarotrigo\/pen\/yLzGdZb\" title=\"Open CodePen\" target=\"_blank\" rel=\"noopener nofollow\">Open CodePen<\/a><\/div>\n<\/div>\n\n\n\n<p>You can both increase or decrease the contrast. Accepts a number or percentage. The behaviour is like the previous brightness filter: a value under <code>100%<\/code> or <code>1<\/code> decreases the contrast of the image, while a value over <code>100%<\/code> or <code>1<\/code> gives more contrast. All modern browsers support this filter.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"8.-hue-rotate-image-filter\">8. Hue-rotate Image Filter<\/h3>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">filter<\/span>: <span class=\"hljs-selector-tag\">hue-rotate<\/span>(&lt;<span class=\"hljs-selector-tag\">angle<\/span>&gt;);\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>A CSS function that allows you to adjust and rotate the colour hue of an image.<\/p>\n<\/blockquote>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_bGoOPZE\" data-src=\"\/\/codepen.io\/anon\/embed\/bGoOPZE?height=450&amp;theme-id=1&amp;slug-hash=bGoOPZE&amp;default-tab=css,result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed bGoOPZE\" title=\"CodePen Embed bGoOPZE\" class=\"cp_embed_iframe lazyload\" style=\"width:100%;overflow:hidden\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" data-load-mode=\"1\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/codepen.io\/alvarotrigo\/pen\/bGoOPZE\" title=\"Open CodePen\" target=\"_blank\" rel=\"noopener nofollow\">Open CodePen<\/a><\/div>\n<\/div>\n\n\n\n<p>The argument is the angle you want to use, so for example, another angle can be <code>hue-rotate(405deg)<\/code>. A positive hue rotation increases the hue value, while a negative rotation decreases the hue value. In this filter, there is no maximum or minimum value. All modern browsers support this image filter (CSS).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"9.-blur-image-filter\">9. Blur Image Filter<\/h3>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">filter<\/span>: <span class=\"hljs-selector-tag\">blur<\/span>(&lt;<span class=\"hljs-selector-tag\">length<\/span>&gt;);\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Apply a blur effect to your images with this simple CSS image filter. Perfect for attenuating background images.<\/p>\n<\/blockquote>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_qBPLzvM\" data-src=\"\/\/codepen.io\/anon\/embed\/qBPLzvM?height=450&amp;theme-id=1&amp;slug-hash=qBPLzvM&amp;default-tab=css,result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed qBPLzvM\" title=\"CodePen Embed qBPLzvM\" class=\"cp_embed_iframe lazyload\" style=\"width:100%;overflow:hidden\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" data-load-mode=\"1\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/codepen.io\/alvarotrigo\/pen\/qBPLzvM\" title=\"Open CodePen\" target=\"_blank\" rel=\"noopener nofollow\">Open CodePen<\/a><\/div>\n<\/div>\n\n\n\n<p>It creates an effect also known as <a href=\"https:\/\/en.wikipedia.org\/wiki\/Gaussian_blur\" target=\"_blank\" rel=\"noopener nofollow\">Gaussian smoothing<\/a>. The argument is the length or amount of blur you want. The higher the number, the higher the blur. Consider this CSS filter for background images. All modern browsers support this filter.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"10.-drop-shadow-image-filter\">10. Drop-shadow Image Filter<\/h3>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-12\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">filter<\/span>: <span class=\"hljs-selector-tag\">drop-shadow<\/span>(&lt;<span class=\"hljs-selector-tag\">length<\/span>&gt;{2,3} &lt;<span class=\"hljs-selector-tag\">color<\/span>&gt;?);\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-12\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>This CSS image filter applies a drop-shadow to your images.<\/p>\n<\/blockquote>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_KKXbjYa\" data-src=\"\/\/codepen.io\/anon\/embed\/KKXbjYa?height=450&amp;theme-id=1&amp;slug-hash=KKXbjYa&amp;default-tab=css,result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed KKXbjYa\" title=\"CodePen Embed KKXbjYa\" class=\"cp_embed_iframe lazyload\" style=\"width:100%;overflow:hidden\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" data-load-mode=\"1\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/codepen.io\/alvarotrigo\/pen\/KKXbjYa\" title=\"Open CodePen\" target=\"_blank\" rel=\"noopener nofollow\">Open CodePen<\/a><\/div>\n<\/div>\n\n\n\n<p>Works by using a blurred background and drawn below the image.<\/p>\n\n\n\n<p>This CSS image filter is very similar to the <code>box-shadow<\/code> property but the difference is the box-shadow creates a shadow behind the entire image but the drop shadow only creates a shadow that conforms to the size of the image itself. All modern browsers support this filter.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"bonus-effect%3A-mix-blend-mode\">Bonus Effect: Mix-Blend Mode<\/h2>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_YzNowed\" data-src=\"\/\/codepen.io\/anon\/embed\/YzNowed?height=450&amp;theme-id=1&amp;slug-hash=YzNowed&amp;default-tab=css,result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed YzNowed\" title=\"CodePen Embed YzNowed\" class=\"cp_embed_iframe lazyload\" style=\"width:100%;overflow:hidden\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" data-load-mode=\"1\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/codepen.io\/alvarotrigo\/pen\/YzNowed\" title=\"Open CodePen\" target=\"_blank\" rel=\"noopener nofollow\">Open CodePen<\/a><\/div>\n<\/div>\n\n\n\n<p>Not exactly a CSS image filter but definitely another cool CSS effect that you should know about.<\/p>\n\n\n\n<p>This CSS property uses the <code>mix-blend-mode<\/code> keyword to allow you to set how the elements should blend together with the background. This is used mainly with text and cool backgrounds like in our example.<\/p>\n\n\n\n<p>There are many different <code>mix-blend-mode<\/code> <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/mix-blend-mode\" target=\"_blank\" rel=\"noopener nofollow\">options<\/a> to work with and not every browser supports this property over SVG elements, so always check to make sure.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"final-thoughts\">Final Thoughts<\/h2>\n\n\n\n<p>It can be quite easy to implement different image effects with CSS. This article shows you how little CSS you need to create an impact on these images.<\/p>\n\n\n\n<p>CSS Image Filters can be very useful when you use large images as backgrounds like in a large image <a href=\"https:\/\/alvarotrigo.com\/blog\/hero-slider\/\">hero slider<\/a> or in a fullscreen website. They will add to the images something that makes them unique.<\/p>\n\n\n\n<p>A lot of the time as well, you can edit the CSS to make the image filter your own, try it out and experience the CSS code and see what happens.<\/p>\n\n\n\n<p> <a href=\"https:\/\/alvarotrigo.com\/fullPage\/\"> <video width=\"680\" height=\"382\" controls muted autoplay loop playsinline> <source src= \"https:\/\/cdn.jsdelivr.net\/gh\/alvarotrigo\/blog-assets\/videos\/fullPage-intro.webm\" type=\"video\/webm\"\/> <source src= \"https:\/\/cdn.jsdelivr.net\/gh\/alvarotrigo\/blog-assets\/videos\/fullPage_intro.mp4\" type=\"video\/mp4\" \/> Your browser does not support the video tag. <\/source><\/source><\/video> <\/a> <\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>If you are into CSS effects or ways to beautify your websites you\u2019ll surely be interested in <a href=\"https:\/\/alvarotrigo.com\/fullPage\/\">fullPage.js<\/a> too &#8211; A cool JavaScript library that you can use to build amazing full-screen experiences with full support for WordPress editors like <a href=\"https:\/\/alvarotrigo.com\/fullPage\/wordpress-plugin-gutenberg\/\">Gutenberg<\/a>, <a href=\"https:\/\/alvarotrigo.com\/fullPage\/wordpress-plugin-divi\/\">Divi<\/a>, and <a href=\"https:\/\/alvarotrigo.com\/fullPage\/wordpress-plugin-elementor\/\">Elementor<\/a>.<\/p>\n<\/blockquote>\n\n\n\n<p>Whatever is your use case, CSS Filters can help you create something unique with little to no effort. They can even serve you as a way to quickly edit images instead of using external software. So wait no more and start using them!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"references\">References<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/filter\" rel=\"nofollow noopener\" target=\"_blank\">Filter CSS property (MDN Web Docs)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/mix-blend-mode\" rel=\"nofollow noopener\" target=\"_blank\">Mix-Blend-Mode (MDN Web Docs)<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"related-articles\">Related articles<\/h2>\n\n\n\n<p>More articles which you may find interesting.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/alvarotrigo.com\/blog\/css-transition-duration\/\">CSS Transition [Duration &amp; Property]<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/alvarotrigo.com\/blog\/css-transition-timing-function\/\">CSS Transition [Timing Function &amp; Delay]<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/alvarotrigo.com\/blog\/10-cool-css-animations-to-add-to-your-website\/\">CSS Animations For Your Website<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/alvarotrigo.com\/blog\/css-highlight-text\/\">Use CSS to Highlight Text<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>CSS filter allows you to modify your images with just a simple line of code. Here&#8217;s how to use it and 10 image filter examples.<\/p>\n","protected":false},"author":11,"featured_media":4908,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[106],"tags":[9,17],"class_list":["post-4909","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-css","tag-css","tag-web"],"acf":[],"_links":{"self":[{"href":"https:\/\/alvarotrigo.com\/blog\/wp-json\/wp\/v2\/posts\/4909","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alvarotrigo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alvarotrigo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alvarotrigo.com\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/alvarotrigo.com\/blog\/wp-json\/wp\/v2\/comments?post=4909"}],"version-history":[{"count":8,"href":"https:\/\/alvarotrigo.com\/blog\/wp-json\/wp\/v2\/posts\/4909\/revisions"}],"predecessor-version":[{"id":18626,"href":"https:\/\/alvarotrigo.com\/blog\/wp-json\/wp\/v2\/posts\/4909\/revisions\/18626"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/alvarotrigo.com\/blog\/wp-json\/wp\/v2\/media\/4908"}],"wp:attachment":[{"href":"https:\/\/alvarotrigo.com\/blog\/wp-json\/wp\/v2\/media?parent=4909"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alvarotrigo.com\/blog\/wp-json\/wp\/v2\/categories?post=4909"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alvarotrigo.com\/blog\/wp-json\/wp\/v2\/tags?post=4909"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}