Chapter 3. What Goes into a Web Document?
IN THIS CHAPTER
Specifying document type
The overall document structure: HTML, Head, and Body
Styles definitions
Block elements: markup for paragraphs and other blocks of content
Inline elements: markup for characters
Special characters (entities)
Organizational elements
Linking to other pages
Images
Comments
Scripts
Putting it all together
HTML has come a long way from its humble beginnings. However, despite the fact that you can use HTML (and its derivatives) for much more than serving up static text documents, the basic organization and structure of the HTML document remains the same.
Before we dive into the specifics of various elements of HTML, it is important to summarize what each element is, what it is used for, and how it affects other elements in the document. This chapter provides a high-level overview of a standard HTML document and its elements. Subsequent chapters cover each element and technology in detail.
Specifying Document Type
One attribute of HTML documents that is frequently overlooked is the <!DOCTYPE>
tag, used to specify a Document Type Definition (DTD). This definition precedes any document tags and exists to inform HTML clients of the format of the following content — what tags to expect, methods to support, and so forth.
You can think of the DTD as a packing list of sorts that tells the user agent and other clients that read the document what to expect (and not expect) in the document. As such, the client can act more intelligently, ...
Get HTML, XHTML, and CSS Bible, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.