This exercise says that “specifies the version of HTML for the browser”. What are the different versions of HTML and why do they exist?
Answer
These days most web developers use HTML5 but pre-HTML5 some common doctypes included HTML 4.01 Strict, HTML 4.01 Transitional, XHTML 1.0 Strict, and XHTML 1.0 Transitional. For example, the HTML 4.01 Strict doctype look like this:
A strict doctype validates differently than the more permissive transitional doctype.
So if you type <!DOCTYPE html> the computer automatically knows that the html you are talking about is html5 or would you have to change the tag to <!DOCTYPE html5>???
The <! DOCTYPE> element is used to specify the type of the current document - the DTD (document type definition). This is necessary for the browser to understand how to interpret the current web page, since HTML exists in several versions, in addition, there is XHTML (EXtensible HyperText Markup Language), similar to HTML, but different in syntax. To the browser “did not get confused” and understood, according to what standard to display a web page and it is necessary to specify <! DOCTYPE> in the first line of the code.
Previously, the index file needed to write large lines like
<! DOCTYPE html PUBLIC" - // W3C // DTD XHTML 1.1 // EN “” http://www.w3.org/TR/xhtml11/DTD/xhtml11. dtd ">
Fortunately, with the advent of HTML5, everything became much simpler and the first line became significantly shorter: <! DOCTYPE html>
When you type the The computer basically knows you want what’s best which is the latest html. The latest in this case being html5, the computer will automatically use html5
So in the future if a new version of html becomes the standard rather than html5, will simply typing indicate using that latest version? And if so, will you then have to specify html5 by using ?
HTML5 is the current Living Standard. As the post above reads, the user agent will always implement the latest recommendations. We will never have to specify HTML5, as it will always be able to run in any newer browser. HTML in its newest form is for the most part fully backward compatible.
Technically, when served as the default text/html it validates to HTML 4.01 specs, save for the new bits.
To clarify, not the computer… The browser. We should always keep our browser(s) up to date so the latest recommendations are available.
Personally I find the notation of !DOCTYPE html a bit contradictary. Most programming languages (that I know of) use the exclamation mark ("!") to state when something IS NOT.
!DOCTYPE html
From my (slightly inexperienced view) it means that the DOCTYPE IS NOT html…
I agree with you but that’s from a different point of view, I bet you’ve been working with java script or something like that but in html, the [!] is to specify something, in this case, the type of HTML you want to use, being HTML 5 because it is currently the latest
When you have time in your studies, you may wish to explore HTML 4.01 in detail. Once you’ve done a cursory read, pull up HTML5 and make note of the shifts in the recommendation paradigm. See if it makes sense to you that those shifts were indeed an improvement of the spec. It’s this detail of understanding that is really necessary if one is to be deemed a professional. Ignore it at one’s own peril.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
</HEAD>
<BODY>
</BODY>
</HTML>
As such, with content, the above is valid HTML 4.01, but not valid HTML5. Why? HTML5 only allows lowercase tags. It follows the XML rule. HTML 4.01 is not XHTML compliant, and therefore not XML compliant.
Technical gibberish, I know, though a little digging solves that impasse. We can write HTML5 as though it is HTML 4.01. That’s the beauty of serving out HTML5 as "text/html" MIME type. The browser takes care of recognizing all the stuff that we used to have to tell it in our meta data. None of that is needed today; but, if you were to use the HTML 4.01 document type, it would all be a necessity. Content type, character set, script type, CSS type, HTML type, etc. All very boring and completely counterintuitive.
If you never take a trip down memory lane, just appreciate that a lot of thought has gone into the HTML language we use today. Be happy that it has progressed to the level it is at present, and exploit its usefulness to the fullest. That’s what need it is intended to serve.