DHTMLdev.com — Dedicated to quality Web development articles and tutorials
The Lowdown on HTML DTDs and DOCTYPEs PDF Print E-mail
Saturday, 25 March 2006
Article Index
The Lowdown on HTML DTDs and DOCTYPEs
An Example DTD
How Does This Relate to XML
The XHTML DTD: a Hybrid and XML and HTML
Taking Advantage of DOCTYPE
Conclusion: Additional Reading

An Example DTD

If you paste in the URL (http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd) from the DOCTYPE you listed, you can download that DTD. It is just a text file, so you can open in any text editor, such as Notepad, or in any HTML editor, such as Dreamweaver, and of course in any XML editor.

If you download and open it, you will see that it defines everything in the XHTML 1.0 Transitional language.

Here is some example code from the XHTML 1.0 Transitional DTD:

You can see in the example above that it defines an element called img and that element is empty, meaning that there is nothing to go between start and end tags, which is why we don't write . It also defines the img element's attributes, such as src, alt, height, width, etc. Those are the attributes for the HTML img tag, for example:

It is an XML thing as well, as you noted. HTML, like XML, is a language that uses tags (officially called elements) for describing data.



Last Updated ( Sunday, 26 March 2006 )
 
< Prev   Next >