简体   繁体   中英

Twitter Bootstrap Glyphicons partial opacity in IE8 and below

I'm using Twitter Bootstrap 's glyphicons in a project and want them to become partially transparent on :hover. Of course everything works as expected in Chrome, FF, Safari and even in IE9+.

In IE7 and IE8 however, the opacity makes the icons look horrible. Below are the essentials for testing:

<!doctype html>
<html>
    <head>
        <link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet">
        <style>
            #icon {
                margin: 50px;
            }

            #icon:hover {
                -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
                filter: alpha(opacity=70);
                opacity: 0.7;
            }
        </style>
    </head>
    <body>
        <i id="icon" class="icon-search"></i>
    </body>
</html>

Any help would be greatly appreciated.

Try changing the order around so that the fallbacks are after the actual declaration.

#icon:hover {

opacity: 0.7;
filter: alpha(opacity=70);
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM