Creating (X)HTML Document Structure
In This Chapter
- Creating a basic (X)HTML document structure
- Defining the (X)HTML document header
- Creating a full-bodied (X)HTML document
The framework of a simple (X)HTML document consists of a head and body. The head provides information to the browser about the document, and the body contains the information that appears in the browser window. The first step to creating an (X)HTML document is defining the framework for that document.
This chapter covers the major elements that you use to set up a basic (X)HTML document structure — including the head and body of the document. We also show you how to tell the browser which version of HTML or XHTML you’re using. Although the version information isn’t necessary for users, browsers use it to make sure that they correctly display document content for your users.
Establishing a Document Structure
Although no two (X)HTML pages are alike — each employs a unique combination of content and elements to define the page — every properly constructed (X)HTML page needs the same basic document structure that includes
- A statement that identifies the document as an (X)HTML document
- A document header
- A document body
Every time you create an (X)HTML document, start with these three elements; you can then fill in the rest of your content and markup to create an individual page.
Although a basic document structure is a requirement for every (X)HTML document, creating it over and over again can be a little monotonous. Most (X)HTML-editing tools automatically set up the basic document structure for you when you open a new document.