9. How to choose the correct document type for your XHTML page

9. How to choose the correct document type for your XHTML page

The Document Type Declaration, or DOCTYPE, is the first thing you'll see in a standard XHTML document.

A DOCTYPE declaration isn't actually XHTML code, but rather an instruction to the web browser. Along with the xmlns value, this is what tells a browser your code is written in XHTML.

The document displayed here uses the Transitional DOCTYPE.

The Transitional DOCTYPE allows you to use some older HTML elements, attributes, and conventions that have been deprecated. (Deprecated means the originators of XHTML, for various reasons, suggest you don't use them any longer.)

Strict, on the other hand, does not allow you to use those deprecated features. Almost all of the code we'll be teaching you will work with the Strict DOCTYPE.

In order to change a document's DOCTYPE, you must alter its Document Type Definition, or DTD.

Let's change this DOCTYPE's DTD references to Strict. Doing so simply requires that we change two words.

1) Change this Transitional to Strict.

2) And then change this one. Make sure to keep the first letter here as lowercase.

That's all there is to it. The document now has a DOCTYPE of XHTML 1.0 Strict.

If you are ever unsure which DOCTYPE a web page should use, you should use Transitional.

This completes the tutorial. You now know about the three document types of XHTML 1.0, and how to use two of them.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

2. An introduction to coding web pages with XHTML

2. An introduction to coding web pages with XHTML In this series of tutorials, you will learn...

3. How is XHTML different from HTML?

3. How is XHTML different from HTML? If you watched the previous tutorial, you'll know that...

5. Some resources you should know about before you begin

5. Some resources you should know about before you begin Before we begin, you should know...

4. Choosing a text editor for web development

4. Choosing a text editor for web development In this tutorial, we will discuss the factors...

6. How to quickly open a local web page in your browser

6. How to quickly open a local web page in your browser They may seem obvious to some, but...