Chapter 3. What Goes into a Web Document?

IN THIS CHAPTER

  • Specifying Document Type

  • Overall Document Structure: HTML, Head, and Body

  • Style 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 content that follows—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, enabling the client to act more intelligently, ...

Get HTML, XHTML, and CSS Bible, Fifth 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.