<!DOCTYPE>
所有 HTML 文档都必须以 <!DOCTYPE>
声明开头。
声明不是 HTML 标记。 对于浏览器来说,这是一个关于预期文档类型的“信息”。
在 HTML5 中,<!DOCTYPE>
声明很简单:
<!DOCTYPE html>
在旧文档(HTML 4 或 XHTML)中,声明更复杂,因为声明必须引用 DTD(文档类型定义)。
<!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">
Tag | HTML 5 | HTML 4 | XHTML |
---|---|---|---|
<a> | Yes | Yes | Yes |
<abbr> | Yes | Yes | Yes |
<acronym> | ❌ | Yes | Yes |
<address> | Yes | Yes | Yes |
<applet> | ❌ | Yes | ❌ |
<area> | Yes | Yes | ❌ |
<article> | Yes | ❌ | ❌ |
<aside> | Yes | ❌ | ❌ |
<audio> | Yes | ❌ | ❌ |
<b> | Yes | Yes | Yes |
<base> | Yes | Yes | Yes |
<basefont> | ❌ | Yes | ❌ |
<bdi> | Yes | ❌ | ❌ |
<bdo> | Yes | Yes | ❌ |
<big> | ❌ | Yes | Yes |
<blockquote> | Yes | Yes | Yes |
<body> | Yes | Yes | Yes |
<br> | Yes | Yes | Yes |
<button> | Yes | Yes | Yes |
<canvas> | Yes | ❌ | ❌ |
<caption> | Yes | Yes | Yes |
<center> | ❌ | Yes | ❌ |
<cite> | Yes | Yes | Yes |
<code> | Yes | Yes | Yes |
<col> | Yes | Yes | ❌ |
<colgroup> | Yes | Yes | ❌ |
<data> | Yes | ❌ | ❌ |
<datalist> | Yes | ❌ | ❌ |
<dd> | Yes | Yes | Yes |
<del> | Yes | Yes | ❌ |
<details> | Yes | ❌ | ❌ |
<dfn> | Yes | Yes | Yes |
<dialog> | Yes | ❌ | ❌ |
<dir> | ❌ | Yes | ❌ |
<div> | Yes | Yes | Yes |
<dl> | Yes | Yes | Yes |
<dt> | Yes | Yes | Yes |
<em> | Yes | Yes | Yes |
<embed> | Yes | ❌ | ❌ |
<fieldset> | Yes | Yes | Yes |
<figcaption> | Yes | ❌ | ❌ |
<figure> | Yes | ❌ | ❌ |
<font> | ❌ | Yes | ❌ |
<footer> | Yes | ❌ | ❌ |
<form> | Yes | Yes | Yes |
<frame> | ❌ | ❌ | ❌ |
<frameset> | ❌ | Yes | ❌ |
<h1> to <h6> | Yes | Yes | Yes |
<head> | Yes | Yes | Yes |
<header> | Yes | ❌ | ❌ |
<hr> | Yes | Yes | Yes |
<html> | Yes | Yes | Yes |
<i> | Yes | Yes | Yes |
<iframe> | Yes | Yes | ❌ |
<img> | Yes | Yes | Yes |
<input> | Yes | Yes | Yes |
<ins> | Yes | Yes | ❌ |
<kbd> | Yes | Yes | Yes |
<label> | Yes | Yes | Yes |
<legend> | Yes | Yes | Yes |
<li> | Yes | Yes | Yes |
<link> | Yes | Yes | Yes |
<main> | Yes | ❌ | ❌ |
<map> | Yes | Yes | ❌ |
<mark> | Yes | ❌ | ❌ |
<meta> | Yes | Yes | Yes |
<meter> | Yes | ❌ | ❌ |
<nav> | Yes | ❌ | ❌ |
<noframes> | ❌ | Yes | ❌ |
<noscript> | Yes | Yes | Yes |
<object> | Yes | Yes | Yes |
<ol> | Yes | Yes | Yes |
<optgroup> | Yes | Yes | Yes |
<option> | Yes | Yes | Yes |
<output> | Yes | ❌ | ❌ |
<p> | Yes | Yes | Yes |
<param> | Yes | Yes | Yes |
<picture> | Yes | ❌ | ❌ |
<pre> | Yes | Yes | Yes |
<progress> | Yes | ❌ | ❌ |
<q> | Yes | Yes | Yes |
<rp> | Yes | ❌ | ❌ |
<rt> | Yes | ❌ | ❌ |
<ruby> | Yes | ❌ | ❌ |
<s> | Yes | Yes | ❌ |
<samp> | Yes | Yes | Yes |
<script> | Yes | Yes | Yes |
<section> | Yes | ❌ | ❌ |
<select> | Yes | Yes | Yes |
<small> | Yes | Yes | Yes |
<source> | Yes | ❌ | ❌ |
<span> | Yes | Yes | Yes |
<strike> | ❌ | Yes | ❌ |
<strong> | Yes | Yes | Yes |
<style> | Yes | Yes | Yes |
<sub> | Yes | Yes | Yes |
<summary> | Yes | ❌ | ❌ |
<sup> | Yes | Yes | Yes |
<table> | Yes | Yes | Yes |
<tbody> | Yes | Yes | ❌ |
<td> | Yes | Yes | Yes |
<template> | Yes | ❌ | ❌ |
<textarea> | Yes | Yes | Yes |
<tfoot> | Yes | Yes | ❌ |
<th> | Yes | Yes | Yes |
<thead> | Yes | Yes | ❌ |
<time> | Yes | ❌ | ❌ |
<title> | Yes | Yes | Yes |
<tr> | Yes | Yes | Yes |
<track> | Yes | ❌ | ❌ |
<tt> | ❌ | Yes | Yes |
<u> | Yes | Yes | ❌ |
<ul> | Yes | Yes | Yes |
<var> | Yes | Yes | Yes |
<video> | Yes | ❌ | ❌ |
<wbr> | Yes | ❌ | ❌ |