我对 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 中使背景颜色正常工作?
最佳答案
您的代码原样似乎无法显示工作页面,至少对我来说在 Chrome 或 Firefox 中是这样。包含“一些文本”的 p 元素显示为顶部:-200 像素,离开页面到顶部,背景是白色的,所以在将鼠标悬停在链接上之前我看不到任何东西。
您是否忘记在代码中包含一些关键行?尝试将所有内容粘贴到文本文件中并进行测试,然后再将其上传到问题中,否则我们将很难为您提供帮助。
我不清楚你想在这里做什么!
关于css - IE9/CSS/背景颜色/填充问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31192793/