This exercise says that <!DOCTYPE html> “specifies the version of HTML for the browser”. What are the different versions of HTML and why do they exist?


#1

Question

This exercise says that “specifies the version of HTML for the browser”. What are the different versions of HTML and why do they exist?

Answer

These days most web developers use HTML5 but pre-HTML5 some common doctypes included HTML 4.01 Strict, HTML 4.01 Transitional, XHTML 1.0 Strict, and XHTML 1.0 Transitional. For example, the HTML 4.01 Strict doctype look like this:

A strict doctype validates differently than the more permissive transitional doctype.

FAQ: Learn HTML Elements - Common HTML Elements - Where Does the Title Appear?