Microsoft’s CSS Filters, Could The Syntax Be Any Uglier?

The answer is no 🙂

While some of the functionality of MS’s CSS filters is actually pretty useful (sue me, I need to use them from time to time), the implementation is ugly as hell. Ryan, one of the smart guys here that helps me fool people into thinking I know what I’m doing, had to implement the Microsoft gradient filter as a (brilliant) hack for a performance issue on a small subset of IE browsers. We were discussing the solution and then he called up the code.

Feast your eyes on this beauty:

#samplediv{
filter: progid:DXImageTransform.Microsoft.gradient (GradientType=0, startColorstr=#ffff3300, endColorstr=#ff000000)
}

Could that be uglier? What’s wrong with something like this:

#samplediv{
filter: gradient (GradientType=0, startColorstr=#ffff3300, endColorstr=#ff000000)
}

At least there’s a chance of remembering that. All that progid: stuff is a nightmare. And really, what does it matter to a developer implementing it on a web page that its a Direct X transformation (as the “DXImageTransform” part implies?) The answer, again, is no.

In case you were wondering, there’s no point to this. I just wanted to share. I need to do more sharing around here.

Leave a Reply

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