Opacity CSS Code

New browsers are good to opacity, but old ones need some special codes to have transparent elements.

.opacityBlock {
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=20)"; /* for IE8 */
filter:alpha(opacity=20); /* for IE7 */
-moz-opacity:0.2; /* Old Mozilla */
-khtml-opacity: 0.2;  /* Safari 1 */
opacity:0.2;  /* New Browsers and IE9  */
}

Remember that opacity will have an effect on all child elements inside opacity changed element.

Share:

Leave a Reply

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