【问题标题】:IE9 / CSS / background color / padding issueIE9/CSS/背景颜色/填充问题
【发布时间】:2015-07-02 19:13:12
【问题描述】:

我遇到了 IE9 和 css 的问题。看起来 IE9 不接受两个元素 p 和 a 的填充定义。背景颜色缩小并且仅在元素的左上角。以下 css 在 Firefox 中运行良好:

<div class="slider">                        
    <p class="claim orange">Some Text</p>
    <a class="claim blue" href="">Some Link</a>         
</div>

<style type="text/css">
.slider p {
    position: absolute;
    top: -200px;
    z-index: 8000;
    padding: 0.5% 2%;
    line-height: 100%;
    color: #fff;
    white-space: nowrap;
    text-transform: uppercase;
}

.claim {
    line-height: 100%;
    font-size: 18px;
}   

.orange { background: #EF7D00 }

.blue {
    color: white;
    font-weight: bold;
    padding: 10px 15px; 
    border-color: white;
}

.blue:hover {
    color: white;
    font-weight: bold;
    padding: 10px 15px; 
    background: #2e6da4;
    border-color: #2e6da4;
    text-decoration: none;
}

</style>

可能是什么问题,在这种情况下,如何让背景颜色在 IE9 中正常工作?

【问题讨论】:

    标签: css firefox internet-explorer-9 background-color


    【解决方案1】:

    您的代码原样似乎没有显示工作页面,至少在 Chrome 或 Firefox 中对我来说是这样。包含“一些文本”的 p 元素显示为 top: -200px,离开页面到顶部,背景是白色的,所以在我将鼠标悬停在链接上之前我什么都看不到。

    您是否忘记在代码中包含一些关键行?尝试将所有内容粘贴到文本文件中并对其进行测试,然后再将其上传到问题中,否则我们将很难为您提供帮助。

    我不清楚你想在这里做什么!

    【讨论】:

    • 感谢您对它进行调查。我应该将它与 FractionSlider (jacksbox.de/stuff/jquery-fractionslider) 结合使用。我正在使用最新下载的 js 和 css,并结合上述行。滑块的背景是图片,这就是为什么元素的颜色是白色的。将鼠标悬停在链接上只会给我一个额外的背景颜色。 p的背景是固定的。在 Firefox 中一切正常,但在 IE9 中,这些元素的整个(除了左上角的一小块)背景颜色都消失了。*cry
    猜你喜欢
    • 2014-06-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多