Document Type Declaration

What is a document type declaration?

It is a short piece of code at the very beginning of an HTML document. It tells the web browser that the document is written in today's HTML, so that the browser displays it correctly.

The document type declaration for HTML looks like this:

<!DOCTYPE html>

It has no closing tag. Upper and lower case don't matter here, so you may also come across <!doctype html>.

In this lesson, you will write the declaration yourself. From the second exercise of the next lesson on, the editor will hide it so that you can focus on the content of the page, and the preview will add it in the background for you. Still, remember it: every HTML document you create on your own must start with it, otherwise the browser may display your page incorrectly.

Instructions

Write the HTML document type declaration on the first line of the code.

Start programming for free

By signing up, you agree to the Terms of Service and Privacy Policy.

Or sign up with:

3/8