Learning XHTML


Home

XHTML 101

Lesson 1
Basic Tags
Global Structure
HTML vs XHTML

Lesson 2
Using <p>, </p> and <br />
XHTML Headers
Strong and Emphasis

Lesson 3
Using <blockquote> </blockquote>

Lesson 4
Changing the Font with CSS

 

Email
John Wilfong


XHTML 101
Lesson 1 - Part 2
Basic Tags for a Web Site

Welcome to the XHTML class. This is the first article where you will learn XHTML. In fact, these are the only tags you need to put up a Web page. But it would be a very plain page.

These are the tags required in every Web page. (Note: some are not technically required by the XHTML specification, but some browsers will not render correctly without them, so it is always better to leave them in than out - the space you save is not worth the problems you might cause.)

The DOCTYPE element is not really an XHTML element, but rather an identifier for the page. In order to create a valid XHTML document, you need to include the DOCTYPE. The DOCTYPE references a DTD, and there are three DTDs you can use:

  • <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    This is the strict DTD, I wouldn't recommend using this DOCTYPE unless you plan to be very careful with your XHTML.
  • <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    This is the transitional DTD. It is the best one to use for most Web sites.
  • <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
    This is the frameset DTD. If you're going to put up a framed page, you should use this DTD.

More about DOCTYPE can be found here.