Back to Top

What is DocType In HTML

The DocType In HTML

Here is the one quick article about DocType in HTML.Generally the Most common question asked in an interview is What is DocType and why it’s important in HTML.

DocType is the short form of “Document Type Definition”.It must be the first statement on a web page which appearing even before any spacing or carriage returns.DocType is not an HTML tag.To know your web browser about the version of HTML you are using ,the doctype comes in because it’s important for web browser to identify the version of HTML so The doctype used to specify which version of HTML the browser should expect to see.With version information, Browser decides how to render code on the screen.

Let’s see one example:

The doctype above statement that we’re using XHTML 1.0 Strict, and includes a URL to which the browser can refer and URL points to the W3C’s specification for XHTML 1.0 Strict.

Let’s have a look with other DocTypes

HTML 4.01 Transitional

It has an all elements and attributes of HTML 4 Strict and with presentational attributes, deprecated elements and link targets.

HTML 4.01 Strict

It has an all elements and attributes of HTML 4 without presentational attributes, deprecated elements and link targets.

XHTML 1.0 Transitional

It’s same as HTML 4.01 Transitional but with the support of XML.

XHTML 1.0 Strict

It’s same as HTML 4.01 Strict but with the support of XML.

XHTML 1.1

It’s same as XHTML 1.0 Strict but allows to add modules.

XHTML Mobile 1.0

It is useful and better to use when the site wants with Mobile support.It’s same as XHTML 1.0 with some XHTML modules and Mobile web application supports.

HTML 5

HTML5 use and it is not require a reference to a DTD.

I hope this explanation is enough to answer the DocType.Also like other post, see here:

Clean HTML content in PHP
Convert RGB to Hex HTML code in PHP

Comments (6)

  1. Deference to post author, some wonderful information .

  2. Good write-up, I’m normal visitor of one’s web site, maintain up the excellent operate, and It is going to be a regular visitor for a lengthy time.

  3. Pretty nice post. I just stumbled upon your blog and wanted to say that I have really enjoyed browsing your blog posts. In any case I’ll be subscribing to your feed and I hope you write again soon!

  4. I am constantly thought about this, thankyou for posting .

  5. What if we remove doctype tag and just use html tags. what difference will it make ? I used canvas tag without declaring doctype and it is working fine.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

How to Create and Use Cookies in PHP

Posted on 8 years ago

Bhumi

To grab content from nested tags in PHP

Posted on 11 years ago

Bhumi