0

我需要在 Internet Explorer 中分配不同的填充值,因为当我声明 a 的高度时,<div>它会将其计算为高度 + 填充(它在 Firefox 和 Chrome 中都可以正常工作)。

这是我的CSS:

#payment{
    width: 265px;
    border: 1px solid #cecece;
    border-radius: 8px;
    -webkit-box-shadow: 0 2px 7px rgba(50,50,50,0.46);
    -moz-box-shadow: 0 2px 7px rgba(50,50,50,0.46);
    box-shadow: 0 2px 7px rgba(50,50,50,0.46);
    -moz-border-radius: 8px;
    -webkit-border-radius: 8px;
    /*display: block;*/
    position: absolute;
    /*float: right;*/
    height: 230px;
    padding: 10px;
    left: 549px;
}
4

2 回答 2

3

您可以将 IE 条件添加到 html 元素并将类分配给特定的 IE 版本。

<!--[if lt IE 7]>      <html lang="en-us" class="lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html lang="en-us" class="lt-ie9 lt-ie8 ie7"> <![endif]-->
<!--[if IE 8]>         <html lang="en-us" class="lt-ie9 ie8"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="en-us"> <!--<![endif]-->

然后你可以在你的选择器前面加上 IE 类。

.lt-ie8 #payment { /* IE7 & below */
    padding: 5px;
}

或者

.ie7 #payment { /* IE7 only */
    padding: 5px;
}
于 2012-12-20T07:51:22.960 回答
1

你应该这样使用:

#payment{
    padding: 10px; /* standard */
    padding: 17px\9; /* IE 8 and below */
    *padding: 15px\9; /* IE 7 and below */
    _padding: 16px\9; /* IE 6 */
}

参考链接 1

参考链接 2

于 2012-12-20T07:40:47.880 回答