參考:HTML5標簽速查表
<!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所支持的元素是不同的,基本的支持情況如下列出。
標簽 | HTML5 | HTML 4.01 / XHTML 1.0 | XHTML 1.1 |
Transitional | Strict | Frameset |
<a>
Yes
Yes
Yes
Yes
Yes
<abbr>
Yes
Yes
Yes
Yes
Yes
<acronym>
No
Yes
Yes
Yes
Yes
<address>
Yes
Yes
Yes
Yes
Yes
<applet>
No
Yes
No
Yes
No
<area>
Yes
Yes
Yes
Yes
No
<article>
Yes
No
No
No
No
<aside>
Yes
No
No
No
No
<audio>
Yes
No
No
No
No
<b>
Yes
Yes
Yes
Yes
Yes
<base>
Yes
Yes
Yes
Yes
Yes
<basefont>
No
Yes
No
Yes
No
<bdi>
Yes
No
No
No
No
<bdo>
Yes
Yes
Yes
Yes
No
<big>
No
Yes
Yes
Yes
Yes
<blockquote>
Yes
Yes
Yes
Yes
Yes
<body>
Yes
Yes
Yes
Yes
Yes
<br>
Yes
Yes
Yes
Yes
Yes
<button>
Yes
Yes
Yes
Yes
Yes
<canvas>
Yes
No
No
No
No
<caption>
Yes
Yes
Yes
Yes
Yes
<center>
No
Yes
No
Yes
No
<cite>
Yes
Yes
Yes
Yes
Yes
<code>
Yes
Yes
Yes
Yes
Yes
<col>
Yes
Yes
Yes
Yes
No
<colgroup>
Yes
Yes
Yes
Yes
No
<command>
Yes
No
No
No
No
<datalist>
Yes
No
No
No
No
<dd>
Yes
Yes
Yes
Yes
Yes
<del>
Yes
Yes
Yes
Yes
No
<details>
Yes
No
No
No
No
<dfn>
Yes
Yes
Yes
Yes
Yes
<dir>
No
Yes
No
Yes
No
<div>
Yes
Yes
Yes
Yes
Yes
<dl>
Yes
Yes
Yes
Yes
Yes
<dt>
Yes
Yes
Yes
Yes
Yes
<em>
Yes
Yes
Yes
Yes
Yes
<embed>
Yes
No
No
No
No
<fieldset>
Yes
Yes
Yes
Yes
Yes
<figcaption>
Yes
No
No
No
No
<figure>
Yes
No
No
No
No
<font>
No
Yes
No
Yes
No
<footer>
Yes
No
No
No
No
<form>
Yes
Yes
Yes
Yes
Yes
<frame>
No
No
No
Yes
No
<frameset>
No
No
No
Yes
No
<h1> to <h6>
Yes
Yes
Yes
Yes
Yes
<head>
Yes
Yes
Yes
Yes
Yes
<header>
Yes
No
No
No
No
<hgroup>
Yes
No
No
No
No
<hr>
Yes
Yes
Yes
Yes
Yes
<html>
Yes
Yes
Yes
Yes
Yes
<i>
Yes
Yes
Yes
Yes
Yes
<iframe>
Yes
Yes
No
Yes
No
<img>
Yes
Yes
Yes
Yes
Yes
<input>
Yes
Yes
Yes
Yes
Yes
<ins>
Yes
Yes
Yes
Yes
No
<keygen>
Yes
No
No
No
No
<kbd>
Yes
Yes
Yes
Yes
Yes
<label>
Yes
Yes
Yes
Yes
Yes
<legend>
Yes
Yes
Yes
Yes
Yes
<li>
Yes
Yes
Yes
Yes
Yes
<link>
Yes
Yes
Yes
Yes
Yes
<map>
Yes
Yes
Yes
Yes
No
<mark>
Yes
No
No
No
No
<menu>
Yes
Yes
No
Yes
No
<meta>
Yes
Yes
Yes
Yes
Yes
<meter>
Yes
No
No
No
No
<nav>
Yes
No
No
No
No
<noframes>
No
Yes
No
Yes
No
<noscript>
Yes
Yes
Yes
Yes
Yes
<object>
Yes
Yes
Yes
Yes
Yes
<ol>
Yes
Yes
Yes
Yes
Yes
<optgroup>
Yes
Yes
Yes
Yes
Yes
<option>
Yes
Yes
Yes
Yes
Yes
<output>
Yes
No
No
No
No
<p>
Yes
Yes
Yes
Yes
Yes
<param>
Yes
Yes
Yes
Yes
Yes
<pre>
Yes
Yes
Yes
Yes
Yes
<progress>
Yes
No
No
No
No
<q>
Yes
Yes
Yes
Yes
Yes
<rp>
Yes
No
No
No
No
<rt>
Yes
No
No
No
No
<ruby>
Yes
No
No
No
No
<s>
Yes
Yes
No
Yes
No
<samp>
Yes
Yes
Yes
Yes
Yes
<script>
Yes
Yes
Yes
Yes
Yes
<section>
Yes
No
No
No
No
<select>
Yes
Yes
Yes
Yes
Yes
<small>
Yes
Yes
Yes
Yes
Yes
<source>
Yes
No
No
No
No
<span>
Yes
Yes
Yes
Yes
Yes
<strike>
No
Yes
No
Yes
No
<strong>
Yes
Yes
Yes
Yes
Yes
<style>
Yes
Yes
Yes
Yes
Yes
<sub>
Yes
Yes
Yes
Yes
Yes
<summary>
Yes
No
No
No
No
<sup>
Yes
Yes
Yes
Yes
Yes
<table>
Yes
Yes
Yes
Yes
Yes
<tbody>
Yes
Yes
Yes
Yes
No
<td>
Yes
Yes
Yes
Yes
Yes
<textarea>
Yes
Yes
Yes
Yes
Yes
<tfoot>
Yes
Yes
Yes
Yes
No
<th>
Yes
Yes
Yes
Yes
Yes
<thead>
Yes
Yes
Yes
Yes
No
<time>
Yes
No
No
No
No
<title>
Yes
Yes
Yes
Yes
Yes
<tr>
Yes
Yes
Yes
Yes
Yes
<track>
Yes
No
No
No
No
<tt>
No
Yes
Yes
Yes
Yes
<u>
No
Yes
No
Yes
No
<ul>
Yes
Yes
Yes
Yes
Yes
<var>
Yes
Yes
Yes
Yes
Yes
<video>
Yes
No
No
No
No
<wbr>
Yes
No
No
No
No