HTML and CSS Reference
In-Depth Information
The body section contains text and elements that do show directly on the Web page.
The purpose of the body section is to describe the contents of the Web page. You will
spend most of your time coding XHTML in the body of a Web page. If you type text in
the body section, it will appear directly on the page.
The body section begins with the <body> tag and ends with the </body> tag.
The following code sample describes the anatomy of a Web page: a header section fol-
lowed by a body section.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
... header information goes here
</head>
<body>
... body information goes here
</body>
</html>
Notice that the XHTML tags are lowercase. This conforms to XML syntax. Notice also
that the DTD statement does not follow this syntax. The DTD statement indicates the
markup language being used and has its own formatting—mixed case.
In XHTML, the <html> tag also needs to describe the XML namespace (xmlns) , which
is the location of the documentation for the elements being used. This additional infor-
mation is added to the <html> tag in the form of an attribute. The xmlns attribute
points to the URL of the XHTML namespace used in the document, the standard
http://www.w3.org/1999/xhtml. The optional lang and xml:lang attributes specify the
spoken language of the document. For example, lang=“en” xml:lang=“en” indicate the
English language. Search engines and screen readers may access these attributes.
FAQ
What are Web page editors?
No special software is needed to create an XHTML document—all you need is a text editor.
Notepad is a text editor that is included with Microsoft Windows. TextEdit is distributed with the
Mac OS X operating system. BBEdit is another popular editing program for Mac users. An
alternative to using a simple text editor or word processor is to use a commercial Web author-
ing tool, such as Microsoft Expression Web or Adobe Dreamweaver. There are also many free
or shareware editors available, including PageBreeze and Emacs. Regardless of the tool you
use, having a solid foundation in XHTML will be useful. The examples in this text use Notepad.
The final version of the basic anatomy of a Web page follows. Note that with the
exception of the specific page title, the first eight lines will usually be the same on every
Web page that you create.
<!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" lang="en" xml:lang="en">
 
Search WWH ::




Custom Search