About the <html> tag


#1

If at the beginning of the HTML files, we have already put !DOCTYPE html to declare to the browser about the language and version of HTML that we’re gonna use. Then why do we have to add the html tag later on, so that anything between the opening and closing html tag will be interpreted as HTML code? Isn’t the declaration at first was enough?
And is that possible that after the !DOCTYPE html declaration, we can use not only HTML code but also other code?


#2

We need a root element.


#3

<!DOCTYPE html> tells the browser of language and version we are going to use

then we need <html></html> is the top level element (also known as root element). Having a top level element is very useful in GUI programming


#4

No, that IS the top level element, but it is indicated in,

<!doctype html>

This is the declaration that assigns the root element, ‘html’.