Doubt regarding basics | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Doubt regarding basics

I typed the basic htm;lformat i.e. <!Doctype html> <html> <head> </head> <body> </body> </html> Then I typed a piece of text between the head and body tags both individually, without using the title tag. When run the file in html format both of them appeared on the same line beside each other. If it is so then what is the requirement of separate head and body tags??

17th May 2019, 12:50 PM
Yash Anand Mutatkar
1 Answer
0
You shouldn't put visual things in the head, that is why the body is there. If you want to separate text, you should do it like this: <html> <head> </head> <body> <div> line1 </div> <div> line2 </div> <!--OR--> <pre> line1 line2 </pre> </body>
17th May 2019, 1:58 PM
Airree
Airree - avatar