Internet Explorer Quirks模式下的Iframe不会以100%宽度呈现 [英] Iframe in Internet Explorer Quirks mode will not render at 100% width

查看:101
本文介绍了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
}

一般来说,想象一下, 网站依靠< html> 元素具有保证金 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>.

这篇关于Internet Explorer Quirks模式下的Iframe不会以100%宽度呈现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆