HTML The Definitive Guide

Free HTML The Definitive Guide by Chuck Musciano Bill Kennedy Page A

Book: HTML The Definitive Guide by Chuck Musciano Bill Kennedy Read Free Book Online
Authors: Chuck Musciano Bill Kennedy
aspects. And it should be readable not only by you, the author, but by others, as well.
    Experienced HTML document writers typically adopt a programming-like style, albeit very relaxed, for their source HTML text. We do the same throughout this book, and that style will become apparent as you compare our source HTML examples with the actual display of the document by a browser.
    Our formatting style is simple, but serves to create readable, easily maintained documents: Except for the document structural tags like ●
    , , and , any HTML
    element we used to structure the content of a document is placed on a separate line and indented to show its nesting level within the document. Such elements include lists, forms, tables, and similar tags.
    Any HTML element used to control the appearance or style of text is inserted in the current line ●
    of text. This includes basic font style tags like (bold text) and document linkages like (hypertext anchor).
    Avoid, where possible, the breaking of a URL onto two lines.
    ●
    Add extra newline characters to set apart special sections of the HTML document; for instance, ●
    around paragraphs or tables.
    The task of maintaining the indentation of your source HTML ranges from trivial to onerous. Some text editors, like Emacs, manage the indentation automatically; others, like common word processors, couldn't care less about indentation and leave the task completely up to you. If your editor makes your life difficult, you might consider striking a compromise, perhaps by indenting the tags to show structure, but leaving the actual text without indentation to make modifications easier.
    No matter what compromises or stands you make on source code style, it's important that you adopt one. You'll be very glad you did when you go back to that HTML document you wrote three months ago searching for that really cool trick you did with. . . . Now, where was that?
    2.13 Forging Ahead
    3.2 Structure of an HTML
    Document

    Chapter 3
    Anatomy of an HTML
    Document
     
    3.2 Structure of an HTML Document
    An HTML document consists of text, which defines the content of the document, and tags, which define the structure and appearance of the document. The structure of an HTML document is simple, consisting of an outer tag enclosing the document head and body:
    
    Barebones HTML Document
    
    This illustrates, in a very simple way, the basic structure of an HTML document.
    
    
    Each document has a head and a body , delimited by the and tags. The head is where you give your HTML document a title and where you indicate other parameters the browser may use when displaying the document. The body is where you put the actual contents of the HTML
    document. This includes the text for display and document control markers (tags) that advise the browser how to display the text. Tags also reference special-effects files, including graphics and sound, and indicate the hot spots ( hyperlinks and anchors ) that link your document to other documents.
    3.1 Appearances Can Deceive
    3.3 HTML Tags

    Chapter 3
    Anatomy of an HTML
    Document
     
    3.3 HTML Tags
    For the most part, HTML document tags are simple to understand and use, since they are made up of common words, abbreviations, and notations. For instance, the and tags tell the browser respectively to start and stop italicizing the text characters that come between them. Accordingly, the syllable "simp" in our barebones HTML example would appear italicized on a browser display.
    The HTML standard and its various extensions define how and where you place tags within a document. Let's take a closer look at that syntactic sugar that holds together all HTML documents.
    3.3.1 The Syntax of a Tag
    Every HTML tag consists of a tag name , sometimes followed by an optional list of tag attributes , all placed between opening and closing brackets (< and >). The simplest