Doctype的实际使用 [英] Actual Use of Doctype

查看:139
本文介绍了Doctype的实际使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然我在w3.org上浏览了很多关于Doctype的信息,并了解了不同类型的doctypes(Transitional,Strict,Frameset)

While I have gone through a lot of information on w3.org about Doctype and understand the different types of doctypes (Transitional, Strict, Frameset)

我仍然不清楚在页面上使用Doctype的实际用途是什么?

I am still not clear what is the actual use of using Doctype on pages?

我的意思是:


  • 是否使用代码中的某些标签阻止开发人员使用
    (例如
    使用严格,我们限制
    开发人员使用某些
    已弃用的标签,例如字体,中心,
    等)

  • Is it to prevent developers from using certain tags in the code (e.g. By using strict, we restrict the developer from using certain deprecated tags like font, center, etc)

是否要向
浏览器提供一些信息,如果是,它是否会影响

以任何方式渲染?

Is it to give some information to the browser and if yes, does it impact
rendering in any way?

请帮我一样。谢谢。

推荐答案

告诉浏览器它应该如何解释页面中的代码。

It's to tell the browser how it should interpret the code in the page.

(如果您将其用作控制开发人员的工具,则存在管理问题......)

(If you use it as a tool to control developers, you have a management problem...)

doctype确实会影响渲染,哪些标签有效,它们可以具有哪些属性,以及如何在客户端脚本中使用它们。过渡性doctype比严格更宽容,但HTML版本也会影响有效性。

The doctype does impact the rendering, what tags are valid, which attributes they can have, and also how you can use them in client script. A transitional doctype is more forgiving than a strict, but the HTML version also affects what's valid.

最大的区别在于有一个doctype标签而没有一个,特别是IE浏览器。如果没有doctype标记,它将以怪异模式呈现页面,其中包括使用非标准框模型,它可以完全搞乱你的布局。

The biggest difference is between having a doctype tag and not having one, especially in Internet Explorer. Without a doctype tag it will render the page in quirks mode, which among other things include use of the non-standard box model, which can mess up your layout completely.

这篇关于Doctype的实际使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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