Internet Explorer Filters

Internet Explorer Filters are a pure CSS implementation that, when used in conjunction with the HTML5 Boilerplate <html> conditional comments, requires no hacks and (almost) validates perfectly!

Note that this CSS will not validate because filter is invalid. If validation is important to you, this could be served via an IE-only stylesheet.

There are two separate IE filters that handle opacity, one for IE6 and 7, and another for IE8. (Scrapped the -ms-filter… who needs it?)

#example1 {
	opacity: .5; /* Everything except IE */
}
html.lte8 #example1 {
	filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50); /* IE6-8 */
	zoom: 1; /* 'hasLayout' required for filters */
}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

One Response to Internet Explorer Filters

  1. aarontgrogg says:

    Updated:
    Changed the CSS selector from html.ie to html.lte8 to prevent the filter from affecting IE9+.
    Dumped -ms-filter, cause, do we really need another line of CSS here? Especially since the plain old filter still works just fine…

    Cheers,
    Atg

Leave a Reply

Your email address will not be published. Required fields are marked *