在具有haslayout属性的div中输入,即具有“margin-left”

时间:2012-04-17 07:12:05

标签: html css internet-explorer

一个简单的html页面。如果你在 IE 中运行它(我的版本是 7 )。你会发现输入有一个“margin-left” “(尺寸为15px) 但如果删除(* zoom:1),我们应该用它来触发haslayout,即“margin-left”消失。

这就是为什么???

<!DOCTYPE>
    <html>
    <head>
    <style>
            body,div,input{margin:0;padding:0;}
            .div-inline{display:inline-block;*display:inline;*zoom:1;border:1px solid red;}
            .marginLeft-15{margin-left:15px;}
    </style>
    </head>
    <body>
        <div class="marginLeft-15">
            <div class="div-inline"><input type="text" id="proxy_unuse_address"></div>
        </div>
    </body>
    </html>

1 个答案:

答案 0 :(得分:0)

我认为display:inline-block;也会触发hasLayout(根据this page),所以为什么不完全删除*display:inline;*zoom:1;样式,它应该有效...