Description
All HTML documents must start with a <!DOCTYPE>
declaration, which is read by web browsers to determine the document type.
The declaration is not an HTML tag.
All HTML5 documents must start with the below declaration.
<!DOCTYPE html>
The declaration is not case sensitive, so it can have any of the below declarations.
<!DOCTYPE html>
<!doctype html>
<!DocType html>
<!Doctype html>
<!docType html>
HTML4 and XHTML Declarations
All older documents (HTML4 or XHTML 1.1) may contain any of the below declarations.
HTML4 declaration looks as below.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
XHTML 1.1 declaration looks as below.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
Attributes
The following table shows the list of supported and unsupported attributes for the <!DOCTYPE>
declaration.
Attribute Type | Details |
Tag-Specific Attributes | It doesn't have any tag-specific attributes. |
Global Attributes | It doesn't support any HTML Global Attributes. |
Event Attributes | It doesn't support any HTML Event Attributes. |
Browser Compatibility
The declaration <!DOCTYPE>
is supported in most modern browsers.
- Google Chrome 1+
- Internet Explorer or Edge 2+
- Firefox 1+
- Apple Safari 1+
- Opera 4+