为什么不在IE8中显示?

时间:2011-04-20 18:49:36

标签: html internet-explorer-8 stylesheet

    <div style="width:180px; height:18px; border-bottom:1px solid #666; position:relative; z-index:500; margin-left:10px;">
        <div style="float:left; width:70px; height:18px; position:absolute; left:0; top:0; z-index:1; background-color:white; ">KEY</div>
        <div style="float:right; height:18px; position:absolute; right:0; top:0; z-index:1; background-color:white; ">VALUE</div>
    </div>

在Chrome,Firefox,Safari等中完美呈现。但在IE8中它不起作用。

1 个答案:

答案 0 :(得分:3)

如果渲染器未正确检测到doctype,则IE8是具有相对定位的混蛋。尝试指定:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "w3.org/TR/html4/loose.dtd">