Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

HTML <!DOCTYPE>


The HTML Document Type

All HTML documents must start with a <!DOCTYPE> declaration.

The declaration is not an HTML tag. It is an "information" to the browser about what document type to expect.

In HTML5, the <!DOCTYPE> declaration is simple:

<!DOCTYPE html>

In older documents (HTML 4 or XHTML), the declaration is more complicated because the declaration must refer to a 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">

You can read more about document types in the <!DOCTYPE> reference.


Valid HTML Elements in Different DOCTYPES

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


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.