Declaring Doctype

Share Button


Before coding a program, you must understand that HTML contains rules: which explains what tags, attributes and values are valid for a particular HTML file. These rules are defined by Document Type Definition(DTD) file or simply the Doctype which is used above all HTML file.

You can use either HTML or XHTML doctype, depending upon your needs. You can understand much about this here.

HTML doctype

HTML 4.01 Strict

This type of doctype allows only tags that are recent and doesn’t allow tags that are deprecated. These tags are not so common and should be used only to create a standard declaration

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"

HTML 4.01 Transitional

A transitional doctype is the most common type and it allows the deprecated tags too to fill the code and that is of a great advantage and most developers use this kind of DTD to their webpage.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

HTML 4.01 Frameset

This is same as the transitional doctype, but the only difference is that it allows additional frameset in a webpage.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"

XHTML doctype

XHTML 1.0 Strict

Similar to the HTML Strict DTD declaration, this one also doesn’t allow deprecated tags into the code.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

XHTML 1.0 Transitional

This one has a slight modification than the Strict declaration by allowing the deprecated tags, so that coders can also choose the old tags.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

XHTML 1.0 Frameset

This allows the deprecated tags and it is just similar to the transitional doctype declaration and with an additional feature of allowing frameset in a page.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"

It is very important to use doctype at the beginning of every HTML file, even though many modern browsers accept HTML without a doctype, as it may lead to future miseries.

Share Button

3 thoughts on “Declaring Doctype

  1. Pingback: replica louis vuitton handbags

Leave a Comment

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