标签必须放在整个html文档的第一行,之后一行就是从标签开始,所有浏览器都支持标签。
标签是用来告诉浏览器用哪个html版本解析当前的html页面。
其中很多DOCTYPE中都带有DTD声明,DTD就是html文档的规范说明,主要有:strict(严格)、transitional(过度)、frameset(框架),严格类型的DTD包含了大部分的html元素和属性,但一些过时的元素已经不再支持(font\u\s\iframe等);过度的包含了所有的html元素和属性,过时的一些元素也支持;框架的DTD是为需要使用框架时所用到的DTD,如无框架,不会用到。
常用的html版本对应的DOCTYPE声明:
html版本 DOCTYPE声明 HTML 5
HTML 4.01 Strict
HTML 4.01 Transitional br />"http://www.w3.org/TR/html4/loose.dtd">
HTML 4.01 Frameset br />"http://www.w3.org/TR/html4/frameset.dtd">
XHTML 1.0 Strict br />"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
XHTML 1.0 Transitional
XHTML 1.0 Frameset br />"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
XHTML 1.1
对应与不同html版本的DOCTYPE所支持的元素是不同的,基本的支持情况如下列出。
标签 HTML5 HTML 4.01 / XHTML 1.0 XHTML 1.1 Transitional Strict Frameset Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes No Yes No Yes Yes Yes Yes No Yes No No No No Yes No No No No Yes No No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes No Yes No Yes No No No No Yes Yes Yes Yes No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No No Yes Yes Yes Yes Yes No Yes No Yes No Yes Yes Yes Yes Yes
Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes No Yes No No No No Yes No No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes No No No No Yes Yes Yes Yes Yes No Yes No Yes No
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No No Yes Yes Yes Yes Yes Yes No No No No Yes No No No No No Yes No Yes No Yes No No No No Yes Yes Yes Yes Yes No No No Yes No No No No Yes No to
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No No Yes No No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes No No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes No No No No Yes Yes No Yes No Yes Yes Yes Yes Yes Yes No No No No Yes No No No No No Yes No Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No No
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No No Yes Yes Yes Yes Yes Yes No No No No Yes No No No No Yes No No No No Yes Yes No Yes No Yes Yes Yes Yes Yes <script></script> Yes Yes Yes Yes Yes Yes No No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No No Yes Yes Yes Yes Yes No Yes No Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No No Yes Yes Yes Yes Yes
Yes Yes Yes Yes Yes
Yes Yes Yes Yes No
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
Yes Yes Yes Yes No
Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes No No No No Yes Yes Yes Yes Yes
Yes Yes Yes Yes Yes Yes No No No No No Yes Yes Yes Yes No Yes No Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No No Yes No No No No
Statement: The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn