iframe会以怪癖模式渲染吗? [英] Will an iframe render in quirks mode?

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

问题描述

我正在设置一个页面,并且很难让它在浏览器中看起来很好(实际上只是IE,因为它可以正确地呈现为mozilla和webkit)。在认真考虑自IE6以来修复的旧IE错误之前,我想排除怪异模式。容器页面具有声明的doctype,但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存在之前发布并被接受了相当长的时间,这改变了问题的条款。我通常会删除这个,以避免捕获任何更多的downvotes但由于答案实际上仍然是真实的,并且遗憾地与浏览器人口统计数据的大部分相关,我将把它留下来。只是请不要再投票了。

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 )

然而,你选择了差不多 作为你的doctype,这意味着无论如何都不允许使用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会以怪癖模式渲染吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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