开发者

rgba not working in IE9

For some reason, I can't get rgba working within my CSS using IE9. I've tested it using Chrome, and it works fine. Not sure what's wrong.

My HTML is:

<!doctype html>

<html lang="en">
    <head>
        <meta charset="utf-8" />

        <title><?php bloginfo('name'); ?> - <?php bloginfo('description'); ?></title>

        <link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet" type="text/css" />
        <link href="http:开发者_运维技巧//fonts.googleapis.com/css?family=Raleway:100&v1" rel="stylesheet" type="text/css" />

        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
    </head>
    <body>
        <?php wp_nav_menu(); ?>
    </body>
</html>

My CSS is:

body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}

body {
    font-size: 62.5%;
}

.menu {
    font-size: 5em;
    font-family: 'Raleway', arial, serif;
}

.menu ul li a {
    background: rgba(0,0,0,0.5);
    text-decoration: none;
}


The new standards support in Internet Explorer 9 requires the browser to be in Internet Explorer 9 Standards mode (“IE9 mode”). The best way to do this is to use a standards !DOCTYPE directive and no X-UA-Compatible meta tag or HTTP header. The !DOCTYPE to invoke IE9 mode is the following:

<!DOCTYPE html>

background-color: rgba(0,0,0,0.5);


Well, I found out why. Seems as though "Compatibility View" was enabled so I disabled it and, voila. I probably clicked it by accident when I wanted to click on the refresh button.


I was having issues with background-color in ie9 as well. After scouring through solutions with my google-fu, I realized I was using this border-radius.htc which was breaking all the CSS in that particular div. Not just the background-color, but the borders and font colors as well. It was being used like this:

    <style>
        .ie-rounded-corner{behavior: url(../include/stylesheets/border-radius.htc); }
    </style>

    <div class="ie-rounded-corner">Hello World</div>

I was using that border-radius hack for ie6/7/8 to add rounded corners on some elements. This breaks the page in IE9. Upon removing that class, everything worked as expected in IE9. My rounded corners are now gone in ie6/7/8. Perhaps a different solution is now needed for legacy IE browsers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜