+ 5

Why is the <html> tag necessary?

You can also write code without it

11th Jul 2018, 5:27 AM
Ahmad Mugmal
Ahmad Mugmal - avatar
5 Answers
+ 6
Hello, Ahmad Mugmal ! The <html> tag is a container that encapsulates the entire content of the web page, including the <head> and <body> tags. Opening and closing tags <html> in the document are optional, but a good style dictates their indispensable use. Typically, the <html> tag comes second in the document, after the document type definition (Document Type Definition, DTD) is set via the <!DOCTYPE> element. The closing </html> tag should always be the last in the document. https://www.sololearn.com/Course/HTML/?ref=app
11th Jul 2018, 5:31 AM
Alexander Sokolov
Alexander Sokolov - avatar
+ 2
.php and .html files are similar, so using <html> tags can help clarify. Also, I think very, very old browsers might get confused if you leave out the <html> tag.
11th Jul 2018, 6:35 AM
James
James - avatar
+ 2
it is the best of the 4 basic tags and it houses everything. css and js cannot stand on their own. they have to be linked to an html file, whether as inline, internal or as external file.
13th Jul 2018, 7:32 PM
OLANIYI Babarinde Isola
OLANIYI Babarinde Isola - avatar
+ 1
Yes it works in all modern browser if we dont write html or head tags(All modern browser does it for us if we miss or dont write). But its like hit or miss. Specially old browser cant render page if html tag is missed. Also you dont know which browser your user is using. So its good practice to include these tags. Hope this helpsâ˜șâ˜ș.
11th Jul 2018, 6:36 AM
Meet Mehta
Meet Mehta - avatar