doctype详解

doctype


w3schools中对doctype是这样解释的:

The declaration must be the very first thing in your HTML document, before the tag.

The declaration is not an HTML tag; it is an instruction to the web browser about what version of HTML the page is written in.

In HTML 4.01, the declaration refers to a DTD, because HTML 4.01 was based on SGML. The DTD specifies the rules for the markup language, so that the browsers render the content correctly.

HTML5 is not based on SGML, and therefore does not require a reference to a DTD.
Tip: Always add the declaration to your HTML documents, so that the browser knows what type of document to expect.

理解

  1. 什么是doctype?
doctype 是一个指令,用于让浏览器知道该页面是用哪个版本的html编写的。
  1. 那么为什么浏览器要知道一个页面是什么版本的html呢?(为什么要使用doctype?)
因为浏览器对于页面有二种不同的呈现方式。

浏览器会根据一个html文档doctype声明来确定该使用何种方式呈现该页面

浏览器浏览器的标准模式与怪异模式的设置与区分方法:http://www.frontopen.com/1385.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值