Pregunta

I am going through my theme I created using HTML5 and CSS3, and trying to fix all of my errors from HTML and CSS. I am trying to get the Opacity attribute to validate to CSS3, and I have had no such luck. I know that it still isn't standard yet, but is there any possible way to get it to validate without removing? I use it as a hover when hovering the logos on the site. Using images to create the effect isn't really an option. Can anyone point me in the right direction? Here is how my logo hover currently looks:

  .logo:hover {

    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=90)";

    filter: alpha(opacity=90);

    opacity: 0.9;

  }

And here is the error:

.logo:hover  Parse Error opacity=90)
¿Fue útil?

Solución

Your CSS is fine, validation isn't everything, though you could remove the old filter: property because only IE older than IE9 uses it, -ms-filter is preferred and will validate.

Just because a CSS file doesn't strictly validate doesn't mean it isn't acceptable, things like proprietary properties and values, or even syntax might be desirable.

Otros consejos

I notice that using quotes, like filter: "alpha(opacity=90)"; gets rid of the parsing error. It still does not validate, but it seems nice to have the validator able to parse the style sheet.

The caveat: I don't know if it still works in IE8 after I inserted the quotes.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top