Should we include the html tag every time in the code?
Short answer, yes, always.
Browsers are capable of parsing more than just HTML, and depend upon well-formed documents to deliver signals that give direction.
The above is the Document Type Declaration the browser (user agents) first sees when the page comes down from the server. In this instance it is the standard declaration to specify HTML5 as the namespace (specifications) the browser should follow.
There is a lot going on behind the scenes when the DOM is assembled. The DOM is a construct of element nodes, all of which descend from a root element. The
html in the above doctype declaration tells the browser that the root element of the document is
<html></html>. In absence of that element, the browser will be left to its own devices (fallback actions). We run a risk of things going awry in some browsers, depending how well they are written. Best advice… Never take risks.
The one tool to keep close at hand when composing a document is the validator…
Familiarize yourself with this tool and how it works. There is a direct entry tab that allows us to paste in a document and validate it. Check ‘show code’ and ‘verbose mode’ checkboxes for the most information and a line numbered source listing in the report.
Never give up on an invalid document. Fix it and take confidence in the fact that most if not all user agents will be able to correctly parse and/or render it.
I think yes because the server won’t know if you’re talking about a different language like Python or CSS.