HTML Doctypes
HTML <!DOCTYPE> Declaration
Definition and Usage
Every HTML document must begin with a <!DOCTYPE>
declaration.
The declaration is not an HTML tag; it's more like a message to the browser about what type of document to anticipate.
In HTML 5, the declaration is straightforward:
<!DOCTYPE html>
Older HTML Documents
In older documents like HTML 4 or XHTML, the declaration is a bit more complex because it needs to mention a DTD (Document Type Definition).
HTML 4.01:
<!DOCTYPE HTML PUBLIC "-//ppt//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
XHTML 1.1:
<!DOCTYPE html PUBLIC "-//ppt//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
Tips and Notes
Tip:
The use of capital letters doesn't matter in the <!DOCTYPE>
declaration.
<!DOCTYPE html>