简体   繁体   English

在IE8中,当高度高于窗口时,-ms-filter背景消失。 (出现滚动条时)

[英]In IE8 -ms-filter background disappears when height is higher than window. (when scrollbar appears)

In IE8, when div is higher than window, -ms-filter background disappears. 在IE8中,当div高于窗口时,-ms-filter背景消失。 In IE7 and below works fine. 在IE7及以下版本中正常运行。 (I could use 1px transparent image, but what if I would need to use transparent color plus background image) (我可以使用1px透明图像,但是如果我需要使用透明颜色加上背景图像怎么办)

Sample code and fiddle: 示例代码和小提琴:

<!DOCTYPE html>
<html lang="sk">
<head>
    <meta charset="utf-8">
    <style>
        html,body{height:100%;margin:0;padding:0;}
        #one{
            float:left;
            height:100%;
            width:50%;
            background:rgba(0,0,0,0.5);
            -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#CC917C6F,endColorstr=#CC917C6F)";
            filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#CC917C6F,endColorstr=#CC917C6F);
        }
        #two{
            float:right;
            height:101%;
            width:50%;
            background:rgba(255,0,0,0.5);
            -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#CCAAAA6F,endColorstr=#CCAAAA6F)";
            filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#CCAAAA6F,endColorstr=#CCAAAA6F);
        }
    </style>
</head>
<body>
    <div id="one"></div>
    <div id="two"></div>
</body>
</html>

http://jsfiddle.net/9dmqg/4/ Thank you. http://jsfiddle.net/9dmqg/4/谢谢。

That is because of the fixed height for p tag. 这是因为p标签的高度固定。 make that fixed height as min-height and add height:auto 将固定高度设置为min-height然后添加height:auto

#one p {
     height:auto; min-height:800px;
}
#two p {
    height:auto; min-height:800px;
}

DEMO 演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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