Welcome to WebHeadStart.org

Web Technologies

Sponsored By

WebHeadStart.org is currently in beta.
Please pardon our appearance as we work to provide you with the most comprehensive reference on today's web technologies.

Interested in advertising on WebHeadStart? Become an advertising partner today!

XHTML Basics

In this section we'll cover the XHTML basics - these important concepts can often account for more then half of the work a Web developer does in making a Web page!

The XHTML Foundation

XHTML pages can be divided into two sections: the head and the body. The head section is where you define the title of your page, write scripts, associate stylesheets, and include meta information which describes the contents of your page to search engines, etc. The body of your XHTML document encloses the content of your page, i.e. the stuff that your visitors will see and read, like graphics and text. Here's what the XHTML code looks like:

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

    <head>
    
        (Insert the page's head information here ...)
    
    </head>
    
    <body>
    
        (Insert the page's body content here ...)
    
    </body>
</html>
view code in new window.
render sample in browser.
Download code sample on your computer.

Let's take a moment to review the basic syntax for the XHTML foundation.

Creating the XHTML <head> element

  • Immediately after the opening <html> element, type the <head> tag.
  • Insert the contents of the <head> section - we'll discuss this shortly.
  • Type </head> to close the element.

Creating the XHTML <body> element

  • Under the closing </head> tag, open the <body> element.
  • Insert the contents of the <body> section - again, we'll discuss this shortly.
  • Type </body> to close the body tag.

Creating the XHTML <title> element

All XHTML pages require a <title> element - we recommend that you choose something short and descriptive, since in most browsers, the title is rendered in the browser's title bar, which has limited space. Here is an example of the <title> element:

Code Sample:
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Learning the XHTML Basics</title>
</head>
view code in new window.
Download code sample on your computer.

To create a title element:

  • Type <title> anywhere between the opening and closing <head> tags.
  • Enter the name of your web page.
  • Type </title> to close the title.

HTML Tutorials

Find a great HTML tutorial and build your own web site. Find out how affordable online learning can be, and expand your horizons.

Start Of Section: XHTML Tutorial Start of Section:
XHTML Tutorial
Previous Page: XHTML Introduction Previous Page:
XHTML Introduction
Next Page:
XHTML Example
Next Page: XHTML Example
Valid XHTML 1.0! Valid CSS! Site Map | Privacy Policy | Terms of Use | WebHeadStart.org © 2005 All Rights Reserved.