Doctype for Html5 and how different it is from Html 4


In this post, I will discuss the DocType for HTML 5 and how the DocType is different in Html5 from Html 4.1.

DocType in Html stands for "Document Type Definition". This should be the first line of text in a valid Html page. The DocType tells the browser what type of document it is and how to process it.

DocType in Html 4.x


Version prior to 5, Html was based on SGML and supported different types of DocTypes. In earlier versions, you could include the DTD and other information in the DocType.

Here is a sample DocType automatically inserted by Visual Studio 2010 when you create an Html page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


You can see that a reference to the DTD is included in it.

DocType in Html5


Html5 has made the DocType very simple. DTD and other attributes are not required any more. Here is the syntax of DocType in Html5:

<!DocType HTML>


The DocType is not case sensitive. This means, all the following are valid:
<!DocType HTML>

<!DOCTYPE HTML>

<!doctype html>


Unlike earlier versionsof Html, DocType is a mandatory tag in Html5. DocType should appear before any other tags including the <html> tag.


Article by Tony John
Tony John is a professional blogger from India, who started his first Weblog in 1998 at Tripod.com. Tony switched to blogging as a passion blended business in the year 2000 and currently operates several popular web properties including IndiaStudyChannel.com, Techulator.com, dotnetspider.com and many more.

Follow Tony John or read 695 articles authored by Tony John

Related Articles

HTML5 Form elements tutorial for HTML tags

Are you searching a tutorial which gives you complete description about HTML5. Here in this tutorial of HTML5 you will read about the form elements generally used in webpages and their validation through HTML5.

More articles: Html 5

Comments

Author: Shravan22 Nov 2014 Member Level: Gold   Points : 4

Thanks a lot Tony sir for this wonderful article. You have explained the things really well. I was a bit confused about these things but your article solved all my doubts. Thanks a lot once again for writing and sharing the article.



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: