Monday, May 9, 2011

How to make div transparent cross browsers?

How to make div transparent cross browsers?

.transparent
{
   filter:alpha(opacity=45)
   -moz-opacity0.45
   opacity0.45
}

2 comments:

  1. What exactly is this and what are the benefits for implementing this type of browser?

    ReplyDelete
  2. Transparency is one of those CSS properties that has a weird history and requires lots of different properties and values to ensure cross browser compatibilit.

    /* This works in IE */
    filter: alpha(opacity=50);

    /* Older than Firefox 0.9 */
    -moz-opacity:0.5;

    /* Safari 1.x (pre WebKit!) */
    -khtml-opacity: 0.5;

    /* Modern!
    /* Firefox 0.9+, Safari 2?, Chrome any?
    /* Opera 9+, IE 9+ */
    opacity: 0.5;

    ReplyDelete