【发布时间】:2012-12-13 19:44:22
【问题描述】:
为什么在 IE8 中,伪元素的背景颜色在父元素的子元素后面流动?文本在前面流动,但背景颜色没有。 Z-index 似乎没有任何帮助。
我无法确定这是否是 IE8 中的错误。这似乎是一个非常常见的用例,但我找不到很多博客文章或与之相关的 SO 问题。
<div id="parent">
<img src="http://placehold.it/200x200">
</div>
#parent{ padding: 20px; }
#parent:before{
content: 'Behind the image';
position: absolute;
top: 0;
left: 0;
width: 100px;
height: 100px;
background-color: red;
}
【问题讨论】:
-
嗨罗伯特,你有没有找到解决这个问题的方法?
-
我真的不记得了——但我想我不记得了
标签: css internet-explorer-8 pseudo-element