MOCKSTACKS
EN
Questions And Answers

More Tutorials









CSS Filter Property

The filter property is used to set the visual effect of an element. This property is mostly used in image content for adjusting the image rendering, background, border, etc.


Parameter Details
blur(x) Blurs the image by x pixels.
brightness(x) Brightens the image at any value above 1.0 or 100%. Below that, the image will be darkened.
contrast(x) Provides more contrast to the image at any value above 1.0 or 100%. Below that, the image will get less saturated.
drop-shadow(h, v, x, y, z) Gives the image a drop-shadow. h and v can have negative values. x, y, and z are optional.
greyscale(x) Shows the image in greyscale, with a maximum value of 1.0 or 100%.
hue-rotate(x) Applies a hue-rotation to the image.
invert(x) Inverts the color of the image with a maximum value of 1.0 or 100%.
opacity(x) Sets how opaque/transparent the image is with a maximum value of 1.0 or 100%.
saturate(x) Saturates the image at any value above 1.0 or 100%. Below that, the image will start to de-saturate.
sepia(x) Converts the image to sepia with a maximum value of 1.0 or 100%.


Blur

.img {
 -webkit-filter: blur(1px);
 filter: blur(1px);
}

Blur Sample image


Drop Shadow

.textShadow {
 -webkit-filter: drop-shadow(10px 10px 1px green);
 filter: drop-shadow(10px 10px 1px green);
}

My shadow always follow me.


Hue Rotate

.hue {
 -webkit-filter: hue-rotate(120deg);
 filter: hue-rotate(120deg);
}

Hue Rotate image sample


Invert Color

.invert {
 width: 100px;
 height: 100px;
 background-color: white;
 -webkit-filter: invert(100%);
 filter: invert(100%);
}






Conclusion

In this page (written and validated by ) you learned about CSS Filter Property . What's Next? If you are interested in completing CSS tutorial, your next topic will be learning about: CSS Cursor Styling.



Incorrect info or code snippet? We take very seriously the accuracy of the information provided on our website. We also make sure to test all snippets and examples provided for each section. If you find any incorrect information, please send us an email about the issue: mockstacks@gmail.com.


Share On:


Mockstacks was launched to help beginners learn programming languages; the site is optimized with no Ads as, Ads might slow down the performance. We also don't track any personal information; we also don't collect any kind of data unless the user provided us a corrected information. Almost all examples have been tested. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. By using Mockstacks.com, you agree to have read and accepted our terms of use, cookies and privacy policy.