HTML & CSS · Junior · Question 1 of 75

Why do HTML documents start with <!DOCTYPE html>?

Explanation

DOCTYPE is neither a tag nor a resource link. It tells the browser the page follows modern standards and switches on standards mode. Without it the browser falls back to quirks mode and emulates old browser bugs (for example, a different box model). The encoding is set by <meta charset="utf-8">, not by DOCTYPE.

Further reading

Problem with a question

HTML & CSS · Junior · question 1

Test yourself

Take the HTML & CSS · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz