+ 2
Does doctype is really necessary at top of the html?
I've found that html works without having <!doctype html> at top of our document. Then what is the use of having it in our document.?
6 Respostas
+ 8
of course it works, but the DOCTYPE action is to tell the browser what version of HTML it is running in order to validate our document, so it is always recommended to include it
look this: https://www.w3.org/wiki/Choosing_the_right_doctype_for_your_HTML_documents
+ 3
You can drop <body> or <html> too and the site will look fine. It's invalid HTML, but browsers will play nice and fill in the gaps.
Always include it, it's just one line :P
+ 2
You can just put plain text, html still works.
+ 1
It depends whether you are using HTML4 or HTML5
HTML5 requires <! doctype html> tag at the top