Here’s the situation: You want to know what version of HTML a web page is written in, but you don’t know how to check.
So you fired up your web browser, asked Google, and came across this website. Welcome, and it’s good that you stopped by. Because that’s exactly what we’re going to talk about in the next few minutes.
To find out how to identify the HTML version of a web page, read on below.
To check the HTML version of a web page, look at the doctype declaration. If it says
<!doctype html>, then the document is HTML5. If it is longer and contains a link, then it’s HTML4.01 or older.
This is what the doctype declaration looks like in an HTML5 document:
<!doctype html> <html> <head> </head> <body> </body> </html>
And this is what it looks like in an HTML 4.01 document:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <head> </head> <body> </body> </html>
The telltale signs of an HTML 4.01 (or older) web page are the word “public” in the doctype declaration and a link to the specification on the World Wide Web Consortium (W3C) website.
In the doctype declaration in HTML5, these two have been omitted.
When the HTML5 standard was finalized, a number of new tags were introduced. We’ve listed the most commonly used of these tags below:
If you see any of these tags when you inspect the HTML markup of a web page in your browser’s developer tools, you’re most probably looking at an HTML document.
To identify the HTML version of a web page, look at the doctype declaration and the tags used on the page. If you can clearly see the use of the HTML5 doctype declaration and HTML5 tags, you can safely assume that it’s an HTML5 document.