DTD - Document Type Definition

How the DTD tags are used in html files?

Explanation

Document Type Definition:
Document Type Definition is the definition tag which tells the type of document to the browser. The attributes can also be added with this tags along with CSS. DTD tag should be in the first line of the html file.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

Html DTD can be defined using three types
Strict DTD
This DOCTYPE declaration still allows elements and presentation attributes that should be in the stylesheet.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

Transitional DTD
This transitional Document Type Definition is used when you know that the users doesnot have the browsers not supporting CSS.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/trans.dtd">

Frameset
If you are using frames in your file, the browser can know that, it is a file having frames by using this doctype definition.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frame.dtd">

The XHTML Document Type Definition specifies that <p> is a valid element, and that it can appear inside a <div>, but not inside a <b>. The URL at the end of your DOCTYPE declaration points to a place where you will find the doctype definition for the favor of HTML you are using.
DTD is also used as Document Type Declaration in XML. This tag have no end tag. The structure of a class of documents is described via element and attribute-list declarations

Ask Questions

Ask Question