D DevBrainBox

HTML5 Doctype

HTML

What is <!DOCTYPE html> in HTML?

<!DOCTYPE html> is a declaration at the very top of an HTML document.

It tells the browser what version of HTML the page is written in, so the browser knows how to render it correctly.

It is not an HTML tag, but an instruction to the browser.

HTML5 Code:

<!DOCTYPE html>

HTML4 Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

HTML5 page structure?

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>My HTML5 Page</title>
</head>
<body>
    <h1>Hello HTML5!</h1>
</body>
</html>

On this page