[英]Strange gap between adjacent divs in IE8 quirks mode
I have a problem with IE8 in quirks mode. 我在怪癖模式下对IE8有问题。 I have an outer div element that wraps two inner divs.
我有一个包装两个内部div的外部div元素。
<div style="margin-left:160px; margin-top:10px; margin-right:0px; height:10px; background:blue;">
<div style="position:relative; float:left; width:10px; height:10px; background:orange;"></div>
<div style="position:relative; margin-left:10px; margin-right:0px;height:10px; background:green;"></div>
</div>
The inner divs should span the whole of the wrapper div, and it works fine in firefox and chrome. 内部div应该覆盖整个包装div,并且在Firefox和chrome中可以正常工作。 But when I view this in IE8 there is a strange gap between orange div and the green div.
但是,当我在IE8中查看时,橙色div和绿色div之间有一个奇怪的差距。 Does anyone know how to fix this (or to work around it)?
有谁知道如何解决(或解决)? Also, I can't put a doctype declaration anywhere in the document.
另外,我不能在文档中的任何地方放置文档类型声明。
Use absolute positioning on the content and relative positioning on the container for quirks mode: 在怪异模式下,对内容使用绝对位置,对容器使用相对位置:
<html lang="en"> <head> <title>Quirksmode Tests</title> </head> <body> <div style="position:relative; margin-left:160px; margin-top:10px; margin-right:0px; height:10px; background-color:blue;"> <div style="position:absolute; top:0; width:100%; right:0; height:10px; background-color:green;"></div> <div style="position:absolute; top:0; left:0; width:10px; height:10px; background-color:orange;"></div> </div> </body> </html>
References 参考文献
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.