{filter:} Filter CSS Property | CSS: Presentation Layer
Standards Based Development
filter was originally released as a Trident non-standard, vendor-specific property with ie 4 for creating multimedia-style effects in web documents. ie 5.5 and up support a rich variety of optimized filters.
Visual filters are css extensions to css properties that can change the display of an object's contents. Visual filters basically mimic JavaScript behaviors, while simplifying them, because they are implemented as css. Static visual filters affect the display of content; transitions affect the way content changes in an object are displayed. Filters can be combined with transitions (time-varying filters), and basic scripting to create visually engaging and interactive documents.
Filters are applied via the filter property, which is a string of filter descriptions using a function-like notation. In the example below, an ie5.5 filter declaration is set inline:
<a style="filter: progid:DXImageTransform.Microsoft.filtername(sProperties)">
This next example shows a filter declaration declared inline on an img / and composed of two filters:
<img id="sample" src="sample.jpg"
style="filter:progid:DXImageTransform.Microsoft.MotionBlur(strenght=50)
progid:DXImageTransform:Microsoft.BasicImage(rotation=2, mirror=1); width="50%" />
Note: in order for filters using ie5.5 filter syntax (so ie5.5 to its deprecation...I think ie8), the element in question must have a layout (easily achieved by setting a dimension like width).
Filters were originally designed for svg, however Mozilla took them up a notch and implemented them for html content (2009), which has now evolved into Filter Effects 1.0.
Enabling filters in css allows practically any dom element to take advantage of them.
css Shaders
css Shaders are defined in the filters spec as well, to bring OpenGL shader technology to css. css Shaders define a filter effects extensibility mechanism and provide rich, easily animated visual effects to all html5 content.
filter property defines the filter(s) to be applied in a declaration. The filter property can use a number of predefined filter functions.
The filter property is animatable.
Filters can be combined:
img{filter: brightness(60%) sepia(100%)}
filter Types
hue-rotate
grayscale
sepia
blur
brightness
contrast
drop-shadow
gamma
invert
opacity
saturate
sharpen
svg Filters in html via css
svg is stylable via css, just like the relationship between html and css. Below, we define a The ie's filters were introduced in ie4 introduced Visual Filters and Transitions, which have been deprecated since ie9. Visual Filters and Transitions provide multimedia-style visual effects in web documents, implemented in css properties. combined with filters and transitions and JavaScript. Note: unless otherwise noted, functions that take a keyword value express with a percentage sign (like The The The The example below combines functions for a nice effect: The Note: according to its spec, Note: the screenshot above shows a screenshot in Chrome on Windows7, when appying image contrast filter example, setting the contrast high: combining image contrast filter and css animations: The The The grayscale filter eliminates the need for double-stacking Using grayscale image filters with css3 Animations, achieves a clean hover effect: The When specifying Combining image filter rotations and css animations, the colors of the The The The Setting The The Functions can be combined in any number of ways to manipulate rendering. The example below combines image filter functions to enhance the contrast and the brightness of the image: Understanding css Filter Effects, Say Hello to css3 Filters, filterfeGaussianBlur filter in an svg with a radius of 2px and assign it an id of gaussian_blur
filter is referenceable in css by the svg's file name and the filter id="gaussian_blur" and applicable to html elements:
img {
filter: url(blur.svg#gaussian_blur);
}
ie Filters
References and Resources
Functions
filter's are set by specifying a value for one of the following functions. If the value is invalid, the function returns "None".34%) also accept a keyword value expressed as a decimnal, like 0.34.filter:url(resource) Functionfilter:url(resource) Function .filter:blur(radius) Functionfilter:blur(radius) Function .
.img-filter-blur-min{-webkit-filter:blur(2px)}

.img-filter-blur-max{-webkit-filter:blur(50px)}
filter:brightness(amount) Functionfilter:brightness(amount) Function accepts percentage key word values to set brightness; filter:brightness(100%) is the same as not applyig a filter; the lower the brightness percentage, the more the image will darken.
.img-filter-brightness-dark{-webkit-filter:brightness(20%)}

.img-filter-brightness-light{-webkit-filter:brightness(80%)}

.img-filter-brightness-sepia{-webkit-filter:brightness(60%) sepia(100%)}
filter:contrast(amount) Functionfilter:contrast(amount) Function .
.img-filter-contrast{-webkit-filter:contrast(200%)}
filter:contrast(100%) is it's default resting position; increasing or decreasing this keyword value will adjust the contrast of the iamge.filter:contrast(0%) should make the img / entirely black, very similar to the result found when applying filter:brightness(0%), as seen below:
.img-filter-contrast-min{-webkit-filter:contrast(0%)}
filter:contrast(0%);; the img / is supposed to be rendered black, however at this moment (2012-11-07), this is not the case.
.img-filter-contrast-cray-cray{-webkit-filter:contrast(2000%)}

.img-filter-contrast-matrix{-webkit-animation: bluePill 1s alternate infinite; }
@-webkit-keyframes bluePill {
0% { -webkit-filter: contrast(2000%); }
100% { -webkit-filter: contrast(100%); }
}
filter:drop-shadow(<shadow>) Functionfilter:drop-shadow(<shadow>) Function .filter:grayscale(amount) Functionfilter:grayscale(amount) Function .img /'s atop each other, and also using canvas to achieve this effect. Applying the grayscale filter in percentages is as simple as turning a grayscale color wheel, to whatever percentage keyword value desired:
.img-filter-grayscale{-ms-filter:grayscale(100%); -moz-filter:grayscale(100%); -o-filter:grayscale(100%); -webkit-filter:grayscale(100%); filter:grayscale(100%)}

.img-filter-grayscale-hoverfx{-ms-transition:filter 1s; -moz-transition:filter 1s; -o-transition:filter 1s; -webkit-transition:filter 1s; transition:filter 1s}
.img-filter-grayscale-hoverfx:hover,.img-filter-grayscale-hoverfx::hover{-ms-filter:grayscale(100%); -moz-filter:grayscale(100%); -o-filter:grayscale(100%); -webkit-filter:grayscale(100%); filter:grayscale(100%)}
filter:hue-rotate(angle) Functionfilter:hue-rotate(angle) Function .filter:hue-rotate(angle) Function in degrees, imagine a color wheel; the number of degrees specified determines where the color wheel stops. So filter:hue-rotate(0deg) will do nothing (the color wheel hasn't moved), while filter:hue-rotate(50deg) will turn the color wheel dial 50deg to the right.
/** doesn't work in Chrome/Win7 **/
.img-filter-hr{-ms-filter:hue-rotate(50deg); -moz-filter:hue-rotate(50deg); -o-filter:hue-rotate(50deg); -webkit-filter:hue-rotate(50deg); filter:hue-rotate(50deg)}
/** had to roll with the lame fix on the fly **/
.img-filter-hr{-webkit-filter: hue-rotate(50deg)}
img / continuously change, like so:
.img-filter-hr-adjust{-webkit-animation: adjustHue 1s alternate infinite}
@-webkit-keyframes adjustHue {
0% { -webkit-filter: hue-rotate(30deg)}
50% { -webkit-filter: hue-rotate(60deg)}
100% { -webkit-filter: hue-rotate(90deg)}
}
filter:invert(amount) Functionfilter:invert(amount) Function inverts images; invert(100%) is the inverse:
.img-filter-invert-max{-webkit-filter:invert(100%)}
filter:invert(amount) Functionfilter:opacity(amount) Function .filter:opacity(amount) Functionfilter:saturate(amount) Function .filter:saturate can achieve a similar effect as setting filter:grayscale(100%), by desaturating the image. filter:saturate(100%) is the property's unchanged (default) state. The further reduced the keyword value of filter:saturate() is, the more color will be removed from the img /. Below, the img / is set to minimum saturation:
.img-filter-saturate-min{-webkit-filter:saturate(0%)}
filter:saturate() on the opposite end of the spectrum, will continously add more color to the img /, like so:
.img-filter-saturate-cray-cray{-webkit-filter:saturate(700%)}
filter: Functionfilter:saturate(amount) Function .filter:sepia(amount) Functionfilter:sepia(amount) Function .
.img-filter-sepia{-webkit-filter:sepia(100%)}
Combining Functions

.img-filters-combined{filter: contrast(175%) brightness(3%)}
filter ToolsReferences and Resources