Internet Explorer Quirks模式下的Iframe不会以100%宽度呈现
我有一个绝对在页面顶部指定的iframe。这实际上是一个添加到客户网页的标题,因为这样的DOCTYPE会有所不同,因此文档模式也是如此。
I have an iframe which is absolutely poitioned at the top of a page. This is actually a header that is added to customer's webpages, as such DOCTYPEs will vary and thus so will the Document mode.
iframe在100%标准下呈现没有问题模式,但不会在Quirksmode中 - 而是大约90或95%左对齐。这里是HTML:
The iframe renders at 100% no problem in Standards mode, but will NOT in Quirksmode - instead around 90 or 95%, left aligned. Here is the HTML:
<iframe
src="http://localhost:8080/pagedetails/28/false"
id="su3-frame"
hspace="0" vspace="0"
leftmargin="0" rightmargin="0"
topmargin="0" marginwidth="0"
style="top: 0px;"
frameborder="0" >
</iframe>
和css:
and the css:
iframe#su3-frame {
width: 100%;
height: 60px;
border: 0;
margin: 0;
padding: 0;
position: absolute;
top: 0; left: 0;
z-index: 100000000;
}
以前见过这个吗?任何建议,我可以尝试的东西?
Anyone seen this before? Any suggestions for stuff I could try?
谢谢
Thanks
这个CSS修正了它(在IE8 / IE7怪癖模式中):
Adding this CSS fixes it (in IE8/IE7 Quirks Mode):
html {
margin: 0;
padding: 0
}
一般来说,想象一下, 网站依靠保证金
或 padding
。
It's surely safe to universally include that - I imagine virtually zero sites are relying on the <html>
element having margin
or padding
.
有些网站申请非零保证金
或 padding
转换为< body>
,但从不转换为< html>
。
Some sites apply a non-zero margin
or padding
to <body>
, but never to <html>
.