Saturday, January 5, 2008

Ever wonder what !DOCTYPE means?

Maybe you've seen it many times but not noticed it. Or maybe you've noticed it and wondered what it actually means. Of course, it could be that you know exactly what it is and what it does!

Anyway, what I'm referring to is a doctype declaration. Most web pages being created today include a doctype declaration.

For example, if you've been creating XHTML files, you would use a line similar to this at the top of your XHTML documents:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


The purpose of a doctype declaration is to declare the Document Type Definition (DTD). A DTD is used in XML to determine the rules that make up that XML application. In this example, XHTML is the XML application - it's an application that is based on the XML syntax and rules etc.

To learn more about DTDs and DOCTYPE declarations, check out the DTD section of Quackit's XML tutorial (or more specifically, the DOCTYPE page demonstrates how to use DOCTYPE).

Even better, why not start at the beginning of the tutorial? Either way, there's a wealth of information about DTDs, DOCTYPES, and XML in general!

No comments: