html的<!DOCTYPE>标签初窥

来源:互联网 时间:1970-01-01

<!DOCTYPE>标签必须放在整个html文档的第一行,之后一行就是从<html>标签开始,所有浏览器都支持<!DOCTYPE>标签。

<!DOCTYPE>标签是用来告诉浏览器用哪个html版本解析当前的html页面。

其中很多DOCTYPE中都带有DTD声明,DTD就是html文档的规范说明,主要有:strict(严格)、transitional(过度)、frameset(框架),严格类型的DTD包含了大部分的html元素和属性,但一些过时的元素已经不再支持(font/u/s/iframe等);过度的包含了所有的html元素和属性,过时的一些元素也支持;框架的DTD是为需要使用框架时所用到的DTD,如无框架,不会用到。

 

常用的html版本对应的DOCTYPE声明:

html版本DOCTYPE声明HTML 5<!DOCTYPE html>HTML 4.01 Strict<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">HTML 4.01 Transitional

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

HTML 4.01 Frameset

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">

XHTML 1.0 Strict

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

XHTML 1.0 Transitional

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

XHTML 1.0 Frameset

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

XHTML 1.1

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

 

 

 

 

 

 

 

 

 

 

 

 

 

 

                                                       

 

对应与不同html版本的DOCTYPE所支持的元素是不同的,基本的支持情况如下列出。

<a>YesYesYesYesYes<abbr>YesYesYesYesYes<acronym>NoYesYesYesYes<address>YesYesYesYesYes<applet>NoYesNoYesNo<area>YesYesYesYesNo<article>YesNoNoNoNo<aside>YesNoNoNoNo<audio>YesNoNoNoNo<b>YesYesYesYesYes<base>YesYesYesYesYes<basefont>NoYesNoYesNo<bdi>YesNoNoNoNo<bdo>YesYesYesYesNo<big>NoYesYesYesYes<blockquote>YesYesYesYesYes<body>YesYesYesYesYes<br>YesYesYesYesYes<button>YesYesYesYesYes<canvas>YesNoNoNoNo<caption>YesYesYesYesYes<center>NoYesNoYesNo<cite>YesYesYesYesYes<code>YesYesYesYesYes<col>YesYesYesYesNo<colgroup>YesYesYesYesNo<command>YesNoNoNoNo<datalist>YesNoNoNoNo<dd>YesYesYesYesYes<del>YesYesYesYesNo<details>YesNoNoNoNo<dfn>YesYesYesYesYes<dir>NoYesNoYesNo<div>YesYesYesYesYes<dl>YesYesYesYesYes<dt>YesYesYesYesYes<em>YesYesYesYesYes<embed>YesNoNoNoNo<fieldset>YesYesYesYesYes<figcaption>YesNoNoNoNo<figure>YesNoNoNoNo<font>NoYesNoYesNo<footer>YesNoNoNoNo<form>YesYesYesYesYes<frame>NoNoNoYesNo<frameset>NoNoNoYesNo<h1> to <h6>YesYesYesYesYes<head>YesYesYesYesYes<header>YesNoNoNoNo<hgroup>YesNoNoNoNo<hr>YesYesYesYesYes<html>YesYesYesYesYes<i>YesYesYesYesYes<iframe>YesYesNoYesNo<img>YesYesYesYesYes<input>YesYesYesYesYes<ins>YesYesYesYesNo<keygen>YesNoNoNoNo<kbd>YesYesYesYesYes<label>YesYesYesYesYes<legend>YesYesYesYesYes<li>YesYesYesYesYes<link>YesYesYesYesYes<map>YesYesYesYesNo<mark>YesNoNoNoNo<menu>YesYesNoYesNo<meta>YesYesYesYesYes<meter>YesNoNoNoNo<nav>YesNoNoNoNo<noframes>NoYesNoYesNo<noscript>YesYesYesYesYes<object>YesYesYesYesYes<ol>YesYesYesYesYes<optgroup>YesYesYesYesYes<option>YesYesYesYesYes<output>YesNoNoNoNo<p>YesYesYesYesYes<param>YesYesYesYesYes<pre>YesYesYesYesYes<progress>YesNoNoNoNo<q>YesYesYesYesYes<rp>YesNoNoNoNo<rt>YesNoNoNoNo<ruby>YesNoNoNoNo<s>YesYesNoYesNo<samp>YesYesYesYesYes<script>YesYesYesYesYes<section>YesNoNoNoNo<select>YesYesYesYesYes<small>YesYesYesYesYes<source>YesNoNoNoNo<span>YesYesYesYesYes<strike>NoYesNoYesNo<strong>YesYesYesYesYes<style>YesYesYesYesYes<sub>YesYesYesYesYes<summary>YesNoNoNoNo<sup>YesYesYesYesYes<table>YesYesYesYesYes<tbody>YesYesYesYesNo<td>YesYesYesYesYes<textarea>YesYesYesYesYes<tfoot>YesYesYesYesNo<th>YesYesYesYesYes<thead>YesYesYesYesNo<time>YesNoNoNoNo<title>YesYesYesYesYes<tr>YesYesYesYesYes<track>YesNoNoNoNo<tt>NoYesYesYesYes<u>NoYesNoYesNo<ul>YesYesYesYesYes<var>YesYesYesYesYes<video>YesNoNoNoNo<wbr>YesNoNoNoNo
标签HTML5HTML 4.01 / XHTML 1.0XHTML 1.1TransitionalStrictFrameset



相关阅读:
Top