bannermuseum

Now that you have a little background, you're ready to build your XHTML document. All web pages contain the same basic structure. We need to start by provide a framework for the website. Your page will begin with declarations (encoding and DOCTYPE). These are followed by the HTML, HEAD, TITLE, and BODY elements.

Your declarations appear at the very beginning of every web page you create.

readRead Chapter 3: Basic (X)HTML Structure by Elizabeth Castro in HTML, XHTML, & CSS, Sixth Edition.

Encoding declaration

You need to declare your encoding. What this means is that you need to tell the system about the software and character set that was used to create your document. As long as you're not using any strange characters you don't really need this statement, but it's good to include one anyway. In most cases, you can just use the statement below:

<?xml version="1.0" encoding="UTF-8"?>

What to learn more about encoding declarations? For a technical explanation, go to W3C Recommendations. For a tutorial on character sets & encodings, go to W3C Tutorial.

DOCTYPE declaration

The first essential statement on a valid webpage is the document type declaration. It simply tells people and browsers what type of HTML was used to create the document. This Document Type Declaration (DTD) should be placed at the top of your page. There are three types: strict, transitional, and frameset.

Strict does not allow deprecated tags. Use transitional if you think you might use deprecated tags. Frameset is used if you are using frames in your document.

It's easiest just to copy the correct DTD rather than retyping and risking an error. If you have trouble with getting a page to validate, you can always go back to HTML 4.01 Transitional.

Use the following DTD if you plan to adhere to the XHTML standards use:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">

Use the following DTD if you plan to mostly use XHTML but might use a few deprecated tags. This is the most common choice:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">

Use the following DTD if you plan to use XHTML and frames:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"DTD/xhtml1-frameset.dtd">

Use the following DTD if you plan to use use HTML 4 rather than XHTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

Your Document

Your document should now look something like this:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">

 

Learn More

You really don't need to know the technical aspects of DOCTYPEs, however if you'd like more information, try the following resources.

A List Apart: Fixing Your Site with the Right Doctype for a list of the correct Doctypes to use as well as more on what a Doctype is used for.

W3C DTDs for different Document Type Definitions for XHTML go to

Other Ideas

The <!DOCTYPE> tag from w3schools

Choosing a DOCTYPE from Web Design Group

Choosing a DOCTYPE from JuicyStudio

DOCTYPE tag from w3schools

 


| eduscapes | IUPUI Online Courses | Teacher Tap | 42explore | escrapbooking | About Us | Contact Us | ©2006 Annette Lamb