XML technologies / CSS / Advanced websites with CSS / CSS property reference / filter
(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)
The property filter works only in Internet Explorer for Windows. It assigns static special effects or animated transitions to HTML elements.
Inherited: no
Values
Internet Explorer for Windows version 4 and later supports 14 static effect filters and two animated transition filters. Starting with version 5.5, it supports a new filter technology offering additional filters, including two procedural surface filters, 16 static effect filters and 17 animated transition filters.
Static filters offer effects such as translucent elements, drop shadows, glowing edges, motion blur, mirroring, rotation, lighting and distortion. Transition filters animate changes to an element, with effects including simple wipes in the style of Microsoft PowerPoint, soft fades, progressive wipes and imaginative pixel transitions. Animated transitions are assigned with CSS and triggered with JavaScript.
Filters are declared in Internet Explorer 4 with the following syntax:
filter: filter(param=value, ...)
In Internet Explorer 5.5, filters are declared as follows:
filter: progid:DXImageTransform.Microsoft.filter(param=value, ...)
Filters can be combined in any sensible way and are specified in a space-separated list.
Default value: none
Compatibility
CSS version: not part of the CSS standard
Internet Explorer for Windows version 4 and later supports 14 static effect filters and two animated transition filters. Starting with version 5.5, it supports a new filter technology offering additional filters, including two procedural surface filters, 16 static effect filters and 17 animated transition filters.
Examples
The following style rule uses the static IE 4 filter dropShadow to create a shadow behind all HTML elements of class schwebend:
.schwebend {
filter: dropShadow(color=#000000, offx=5, offy=5);
}The following example assigns the element with ID symbolleiste the animated transition filter Pixelate for display in IE 5.5. A JavaScript event handler runs once the page is fully loaded. It activates the filter and uses Apply() to assign the initial transition state. It then makes the element visible (it is still hidden in CSS) and plays the transition with Play():
<style type="text/css">
#symbolleiste {
visibility: hidden;
filter: progid:DXImageTransform.Microsoft.Pixelate(MaxSquare=50, Duration=1, Enabled=false);
}
</style>
<script type="text/javascript" language="JavaScript">
window.onload = function() {
var symbolleiste = document.getElementById('toolbar');
symbolleiste.filters[0].enabled = true;
symbolleiste.filters[0].Apply();
symbolleiste.style.visibility='visible';
symbolleiste.filters[0].Play();
}
</script>
Copyright © 2006 of the German translation, dpunkt.verlag GmbH
You may print the online version for your private use.
Otherwise, this chapter from “CSS − Anspruchsvolle Websites mit Cascading Stylesheets” is subject to the same conditions as the bound edition: the work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
dpunkt.verlag GmbH, Ringstraße 19, 69115 Heidelberg