Doctype和Quirk模式以及HTML 5 [英] Doctype and Quirk modes and HTML 5

查看:145
本文介绍了Doctype和Quirk模式以及HTML 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我度过了非常恐怖的时光.我们有一个没有<DOCTYPE>的大型站点,当我使用IE10运行它时,它进入了怪异模式,并且在进行一些CSS更改后看起来还可以.一旦添加echo "<!DOCTYPE HTML>";

I am having quite a horrible time. We have a massive site that has no <DOCTYPE> and when I run it with IE10 it goes into quirks mode and after some CSS changes looks ok. As soon as I add echo "<!DOCTYPE HTML>";

整个站点看起来糟透了,而CSS并没有达到预期的效果.它将浏览器模式转换为IE10,将docmode转换为标准模式.有没有办法保留HTML 5功能,但使用IE5 Quirks模式或只是Quirks模式,以便CSS看起来正确?

The complete site looks terrible and the CSS is not looking as it suppose to. It turns the browser mode to IE10 and docmode to standard. Is there a way to keep HTML 5 functionality but use IE5 Quirks mode or just Quirks mode so the CSS will look correct?

推荐答案

否.怪癖模式的全部要点是它是IE5的兼容模式.这意味着,除了更改布局模式之外,它还关闭了自IE5以来发明的大多数浏览器功能.

No. The whole point of quirks mode is that it's a compatibility mode for IE5. This means that in addition to changing the layout mode, it also switches off most of the browser features that have been invented since IE5.

因此,最直接的答案是否",您不能混合使用Quirks模式和HTML5.只是不可能发生.

Therefore the blunt answer is no, you cannot mix Quirks mode and HTML5. It just can't happen.

但是,有一些好消息对您来说:从快速模式切换到标准模式实际上比乍一看要容易.

However there is some good news for you: switching from quirks mode to standards mode is actually easier than it looks at first glance.

您不必遍历整个站点即可更改所有CSS以适应不同的盒型模型,因为标准模式确实具有CSS功能,可让您在保持标准模式的同时使用怪癖模式盒型模型.

You don't have to go through your whole site changing all the CSS to suit the different box model, because standards mode does have a CSS feature that allows you to use the quirks mode box model while still remaining in standards mode.

只需在CSS代码顶部添加以下内容:

Simply add the following to the top of your CSS code:

* {box-sizing:border-box;}

这将更改您的所有元素以使用怪癖模式"框模型,但是您的页面仍将处于标准模式.

This will change all your elements to use the quirks mode box model, but your page will still be in standards mode.

这应该可以解决您遇到的大部分(如果不是全部)布局问题.

This should sort out most (if not all) of the layout issues you've been having.

希望有帮助.

这篇关于Doctype和Quirk模式以及HTML 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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