What is the use of <html> , <body> , <head> ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson

What is the use of <html> , <body> , <head> ?

I don't know if I am the only one who has ever tried this , but when you put normal text outside of the <html> tag in a . html file and open it in the browser it works . A <title> tag works outside <head> still works . And text outside the <body> tag appears in the body and works fine . So what is the point of the tags anyway ?

8th Nov 2021, 10:29 AM
Richard - avatar
3 Answers
+ 2
It works because browsers what most people use are smart, and place this tags in right place. But not all browsers do this, and is important to write code in right way to dont make any error. Also search engine, screen readers use this to check page. If you dont write in right way thay will have problem to understand your page. Head is used to tell browsers something about page, like more information how to render or how search engine to understand page... In body we place visual things like text,images....
8th Nov 2021, 11:05 AM
PanicS - avatar
+ 1
There is no need for you to post such questions here. if you just google this there are very obvious answers for these types of questions.
8th Nov 2021, 11:06 AM
zexu knub
zexu knub - avatar
+ 1
Html is the root tag for application Head is the tag defines styles and script files or codes Body is the tag defines script code or content of the web page
9th Nov 2021, 6:32 AM
sree harsha
sree harsha - avatar