HTML5 Doctype

The HTML5 DOCTYPE is surprisingly simple to remember and use.

Overview

In general DOCTYPE declarations tell the browser what version of HTML the page is written in. They are required and must be placed at the top of your document before the <html> or <head> tags. While previous versions of HTML had various DOCTYPE declarations, HTML5 has only one.

Declaration

HTML
<!DOCTYPE html>

It's that easy.

Here's what it looks like as part of a basic page.

<!DOCTYPE html>
<html>
<head>
<title>DOCTYPE Example</title>
</head>
<body>
<h1>I'm an HTML5 Page</h1>
</body>
</html>

Notes

  • While often capitalized it's worth noting that the declaration is case insensitive.

Published: Aug 10th, 2019

Updated: Sep 1st, 2019