Snippets

Snippet #1: Cross-Browser Opacity

Now for some snippets! Basically, just code that might be handy on a cheat sheet. Nothing complicated.

This one will enable proper CSS opacity across all browsers (albeit with some caveats in Internet Explorer, which will behave slightly differently at times):

selector {
  filter: alpha(opacity = 50); /* IE 5.5+ */
  -ms-filter: alpha(opacity = 50); /* Overrides the previous in IE 8 */
  opacity: .5; /* Overrides both of the previous in IE 9, works for all other browsers. */
}

Leave a Reply

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