Doubt regarding basics | Sololearn: Learn to code for FREE!


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??

5/17/2019 12:50:52 PM

Yash Anand Mutatkar

1 Answer

New Answer


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>