PDA

View Full Version : filter property doesn't validate



gandalf117
30 Mar 2010, 03:53 AM
I am trying to implement some transparency in IE which doesn't understand opacity directly. I have to use filters and I use the following css rule:

* html div.className
{
filter: alpha(opacity=50);
}

This doesn't validate correctly! It says: * html div.className Parse Error opacity=50)

The same validation error occurs for all filters such as filter: chroma(color=pink) or filter: shadow(color=#00cc66, direction=45), etc.

What is going on? Are we not supposed to use filters at all?
How would things look properly in IE then?
Do you know any workaround for this?

Jason
30 Mar 2010, 04:06 AM
IE is a beast of its own. Validation really doesn't matter. All of my sites used to validate. Now none of them do because I need to use an IE filter or a browser specific call like -moz-border-radius.

Validation is only important to ensure that your code is correctly structured and formatted. If a few lines fail because you are using a CSS3 property or a browser specific call it doesn't matter.

You need to remember that just because your code validates doesn't mean that you have written good code. Validated code simply means you have followed the conventions of the language. I could validate a table based design, wouldn't mean that it has been well programmed. Similarly I could create the most obtuse and bloated 500KB stylesheet. This would validate but it would be terrible work.

Seriously don't worry about it.