位置:固定在Internet Explorer中不起作用

时间:2012-03-16 13:58:01

标签: css position fixed

我只是不明白。

我为网站提供了三个简单的行。只是那三个:

<div style='height: 3000px; border: 10px dotted blue;'>
<div style='position: fixed; top: 100px; left: 100px; border: 2px dashed red; height: 100px; width: 100px;'></div>
</div>

现在有人可以解释一下,为什么固定的内部div不会停留在Internet Explorer中的位置?在Firefox中完美运行......

谢谢你的帮助!

1 个答案:

答案 0 :(得分:7)

一般情况下:如果Internet Explorer显示网页的方式有些可疑,那可能就是它位于quirks mode

很多时候发生这种情况是因为遗忘了DTD (=doctype declaration)

尝试添加DTD以及正确的html页面结构,它可能会解决您的问题。

虽然它是Microsoft产品,但是如果你这样做的话,Internet Explorer实际上也会遵守和遵循标准。