我正在使用带有position: fixed
的div来重叠图像。这在Firefox中可以正常工作,但在IE8中则不能。 div仅位于图像下方,即使我使用top和left参数也是如此。
Example of my Problem
这是一个已知的错误?
最佳答案
这不是唯一的方法,但至少应该为您提供一个良好的起点。
http://jsfiddle.net/lollero/EREc7/-具有position: relative;
的父元素可确保将position: absolute
作为重叠div的元素将与图像保持一致,无论您将图像放在何处。
http://jsfiddle.net/lollero/EREc7/1/-与边框相同
您还可以执行以下操作:
position: relative;
z-index: 4 /* The higher the number the higher the element is. make sure to*/
top: -50px;
left: 0px;
像这样:
http://jsfiddle.net/lollero/EREc7/3/
请注意,第一个是最灵活的。
这是一个更大的例子
http://jsfiddle.net/lollero/EREc7/4/
评论示例:
http://jsfiddle.net/lollero/nBk79/1
http://jsfiddle.net/lollero/nBk79/6/
关于html - DIV重叠IMG IE 8,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7651084/