Content · Web Development · HTML

HTML <!DOCTYPE html>: Purpose and Standards Mode

The doctype is a small line with a big effect: it asks the browser to use standards mode. Modern HTML uses <!doctype html> at the start of the file.

1 views Published Oct 19, 2026 Updated Oct 19, 2026 Admin

The doctype is a small line with a big effect: it asks the browser to use standards mode. Modern HTML uses <!doctype html> at the start of the file.

What You Need to Know


It is not the same thing as the html element, and it does not identify the page language. Those are different responsibilities.

The HTML doctype is not a closing tag and is not an HTML element; keep it at the start of each complete document.

Example: See It in Action


Add this example to the appropriate part of a practice HTML page. Read each line before you open the page in your browser.

<!doctype html>
<html lang="en">
    <head><title>Standards Mode</title>
    </head>
    <body>
        <p>This page uses the HTML doctype.</p>
    </body>
</html>

Let’s Understand the Example


  • The html element holds the complete page and usually names its language.
  • The head contains useful page information for the browser, such as its title and character encoding.
  • The title names the page in the browser tab. It is different from the heading shown on the page.
  • Lang tells tools which language the text uses, helping pronunciation and language-aware features.

Some of the markup affects the browser tab or page settings rather than appearing as visible text. Check the browser tab and inspector as well as the page itself.

What Should You See?


The browser tab should show “Standards Mode”.

Open the page and compare what appears in the browser tab with the heading inside the document. Both have different jobs.

Try It Yourself


  1. Create two test files, one with the doctype and one without, and compare the browser mode.
  2. Save your changes, open or refresh the page, and compare the result with the original example.
  3. Tell a friend what your change did. If you are not sure, undo it, refresh the page, and compare.

Common Beginner Mistakes


  • Writing <doctype> or trying to add a closing </!doctype> tag.
  • The title in the browser tab and the heading visible in the page are different pieces of information.

Key Takeaways


  • The doctype is a small line with a big effect: it asks the browser to use standards mode.
  • The html element holds the complete page and usually names its language.
  • The HTML doctype is not a closing tag and is not an HTML element; keep it at the start of each complete document.
Share this resourceSend this page to someone who may find it useful.