HTML <!DOCTYPE>

HTML 文档类型

所有 HTML 文档必须以 <!DOCTYPE> 声明开头。

该声明并非一个 HTML 标签。它是一条“信息”,告知浏览器期望的文档类型。

在 HTML5 中,<!DOCTYPE> 声明非常简单:

<!DOCTYPE html>

在更老的文档中(HTML 4 或 XHTML),该声明更为复杂,因为声明必须引用 DTD (Document Type Definition)。

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

不同 DOCTYPE 中的有效 HTML 元素

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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值