iframe 会在 quirks 模式下呈现吗? [英] Will an iframe render in quirks mode?

查看:29
本文介绍了iframe 会在 quirks 模式下呈现吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设置一个页面,但很难让它在浏览器中看起来很好(实际上只是 IE,因为它可以正确呈现给 mozilla 和 webkit).在认真考虑自 IE6 以来修复的旧 IE 错误之前,我想排除怪癖模式.容器页面有一个声明的文档类型,但是 iframe 代码没有.iframe 内容会以 quirks-mode(因为它没有 doctype)还是以标准模式(因为容器有 doctype)呈现?来源遵循这个方案:

I'm working on setting up a page and am having difficulty with getting it to look well across browsers (actually just IE, as it renders properly for mozilla and webkit). I'm wanting to rule out quirks mode before seriously considering old IE bugs fixed since IE6. The container page has a declared doctype, however the iframe code does not. Will the iframe content be rendered in quirks-mode (because it does not have a doctype) or standards mode (because the container has a doctype)? The source follows this scheme:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
...
<body>
...
<iframe ...>
    <html>
    <head>
    ...
    </head>
    <body>
    ....
    </body>
    </html>
</iframe>
...
</body>
</html>

推荐答案


CAVEAT EMPTOR

遗憾的是,有些人没有注意到这个答案在 IE9 出现之前发布并接受了很长时间,这改变了问题的条款.我通常会删除它以避免捕获更多的反对票,但由于答案实际上仍然是正确的,并且可悲的是与浏览器人口统计的很大一部分相关,我会留下它.请不要再对它投反对票了.

Quirksmode:IE 将 iframe 渲染为单独的文档节点,不继承 doctype,默认为 quirks.

Quirksmode: IE renders iframes as separate document nodes, doctype is not inherited, and quirks is the default.

其他人的演示您的问题和非继承证明(感谢我的书签 :P )

somebody else's demonstration of your problem and proof of non-inheritance (with thanks to my bookmarks :P )

但是,您选择了几乎"作为您的文档类型,这意味着无论如何都不允许使用 iframe.获得有效 iframe 的唯一方法是父级是否有怪癖,这使得继承与否成为一个有争议的问题.

However, you've chosen "Almost" as your doctype which means iframes aren't allowed anyway. The only way you could get valid iframes is if the parent was in quirks which makes inheritance or not a moot point.

推荐阅读.

这篇关于iframe 会在 quirks 模式下呈现吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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