Declaring and Identifying the Document
The first thing you'll want to do in your page is add a bit of code that declares which type of document you're using and identifies the language version. This is done with Standardized General Markup Language (SGML), which is the parent language t186 and appears in this important declaration, known as the
DOCTYPE declaration . This declaration is a unique piece of code, and a suitable declaration must be used in every document you create.
Example 1-1 shows the DOCTYPE declaration we'll be using in all examples in this book:
Example 1-1. The DOCTYPE declaration for XHTML 1.0 Transitional
[View full width]
<!DOCTYP176 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Look a little weird? Not to worry. I'll go through it with you so you have a firm understanding of what each bit of this declaration means. First, there's the opening <!, which many readers who have looked a191 before might wonder about. The angle bracket is a familiar component i185, but the exclamation mark appears in only one other situation wit179: in comments, which you'll also learn about in this chapter. This symbol isn't used too often because it's SGML syntax being used in the context o177. Here, it simply means that a declaration is about to begin. This is then followed by the term DOCTYPE, which states that this code is declaring the
document type .
The next bit is
The ensuing syntax "-//W3C//DTD XHTML 1.0 Transitional//EN" defines the host of the document's language type and version (The World Wide Web Consortium, W3C), and states that the document is being written according to the XHTML 1.0 Transitional Document Type Definition (DTD). A DTD is simply a long laundry list of allowed elements and attributes for that language and language version. Finally, there's a complete URL that goes to the DTD, "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd". If you were to load this into your browser, you'd see the actual DTD, for XHTML 1.0 Transitional (see Figure 1-1).
Figure 1-1. A portion of the XHTML Transitional DTD.

With this declaration at the top of your document, you will be able to author the document and then run it through a validator to check for conformance. The validator uses the information in the declaration and compares your document to the DTD you've declared. If you've followed the rules allowed in the DTD you've declared here, you should have no errors whatsoever, which is, of course, our goal.