Mahipal

Mahipal

<!DOCTYPE html>

<!DOCTYPE html>

When i started learning html few days ago, i used to forget mentioning <!DOCTYPE html>.

I thought learning more about it, i will start forgetting less.

So, What does it mean ? What happens if you don't or want to write ? Why should you write it at all ? and also in the beginning of the file and not in second line or after.

<!DOCTYPE html>

<! > markup declaration, that is carried forward from earlier versions of HTML. To let browser know that, <! This is HTML version x.x document !> or <!-- This is comment -- >

DOCTYPE - Documentation Type

html - version of HTML. Here it means HTML5.

Some History

Back old days, Web Browser was first developed in 1990 and NCSA Mosaic was the first browser to display images and text simultaneously and led to the Internet Boom.

Netscape Navigator developed by Netscape which employed many of the original Mosaic authors. Firefox is the successor to Netscape, as the Mozilla community was created by Netscape in 1998 before their acquisition by AOL.

Spyglass, Inc. licensed the technology and trademarks from NCSA for producing its own web browser, Microsoft licensed Spyglass Mosaic and later purchased.

Among few other players, Netscape and Microsoft had majority market share. Both Microsoft and Netscape liberally incorporated proprietary extensions to HTML in their products, and tried to gain an edge by product differentiation.

If you want more on this, this is the place.

Though W3C is in place many did not follow while developing their browsers. Here you can find what others opined back then.

Back to Present

Major upgrade of HTML Web Standards is v5.0 (W3C and WHATWG were working together)

W3C earlier documented all the standards/api's at WebPlatform and Later moved to MDN

As of today, Most of the browsers support these recommended standards, called Full Standards Mode i.e., the behavior described by the HTML and CSS specifications

So by writing <!DOCTYPE html> in the first line of your file, you are telling the Browsers to render the content based on the Full Standards Mode.

Here comes other 2 modes

The only purpose of DOCTYPE is for the browser is to know on which mode rendering has to be. (and as to prevent entering Quirks mode as default).

Even if you write a comment on the first line and second line as DOCTYPE, your browser will enter quirks mode, and you will see unexpected behavior.

But what if you want to support your content on old Browsers i.e., before HTML 5.0, Nah. There is no reason that you want to spin your head on that. But if you want to really to support Legacy browsers or give a try, this is the link.

Apart from W3C, which is known best standard body, few other standards are

  • WHATWG - were responsible for the modernization of the HTML
  • ECMA - responsible for ECMAScript, which JavaScript is based on
  • Khronos - publish technologies for 3D graphics, such as WebGL
 
Share this