+ 1

Questions About Coding in HTML

Why do we need a <head></head> if we can just put <p></p>? Why do we have <!DOCTYPE HTML> when we have <html></html>? And what purpose does it serve? Is it important?

5th Jan 2019, 3:11 AM
Yah
Yah - avatar
3 Answers
+ 2
Yes,they are very much important. The <head> element is a container for all the head elements can include a title for the document, scripts, styles, meta information etc. <!doctype HTML> is needed to define html5 document. Visit the link to know more about doctype! http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
5th Jan 2019, 3:49 AM
AL Araf
AL Araf - avatar
0
The head contains istructions which helps browsers to understand and display the code. Aside of that there are also info for search engines which help them to index the site
5th Jan 2019, 7:09 AM
wenz
wenz - avatar
0
All the tags define how the page is represented... You wouldn't say something is a book because there a bunch of words next to each other. You would want a cover, a summary, chapters, paragraphs... Would be super hard to read...
5th Jan 2019, 8:20 PM
Regina Regenbogen
Regina Regenbogen - avatar