|
To access the contents, click the chapter and section titles.
HTML 4.0 Sourcebook
DIV Element: A Block Division of the BODY
DIV marks a block of the document as a logical group or division and is used to specify generic properties for an entire block. DIV supports the standard generic and event-handler attributes described earlier in this chapter. Note that the event handlers are only partially supported by Internet Explorer 4 and are not supported by Netscape Navigator 4. DIV can also take an ALIGN attribute, to specify the desired text alignment within the block or within any other block element within the block. The allowed values are left, center, right, and justify, which call for left-aligned, center-aligned, right-aligned, and fully justified text, respectively. Note that many browsers do not support justified text. Text alignment can also be specified using a style sheet, as discussed in Chapter 7. DIV implies the end of any paragraph and will cause a line break in the text. Other than this, DIV does not affect the formatting or presentation of a document (i.e., it does not add any extra vertical spacing) and is simply used to more formally organize the document content. Figure 6.13 and Figure 6.14 show an example of this use of DIV. Hn Elements: Headings
The elements H1 through H6 denote headings. There is no forced hierarchy in these headings, but for consistency you should use the top level (H1) for main headings and lower levels for progressively less important ones. You should also avoid skipping heading levels within a document, as this breaks the logical structure and may cause problems when converting the document into another form or when automatically generating HTML table of contents documents.
Renderings of headings are very much browser-dependent. Most graphical browsers left-adjust headings and use progressively smaller fonts as heading importance decreases (from H1 to H6). Others, such as lynx, render H1 headings as capitalized strings centered on the page. Examples are shown in figures throughout this chapter. As a general rule, hypertext documents should be broken up such that each page does not occupy more than one or two browser screen areas. Across the collection of pages, you can then use H1 or H2 elements to mark the main headings for the collection and H3 and greater to mark subheadings. Using heading elements consistently across the documents makes it easy for a user (or indexing software) to distinguish the relative position of a sectionor an entire documentwith respect to the entire collection. Heading elements support the standard generic and event-handler attributes described earlier in this chapter. Note that the event handlers are only partially supported by Internet Explorer 4 and are not supported by Netscape Navigator 4. Headings also support an optional ALIGN attribute, which can take the values left, center, right, and justify. The value left left-justifies the title flush with the left margin (this is the default), while the value right flushes the title to the right window margin. The value center causes the heading to be centered on the display window. The value justify calls for text to be justified between the left and right margins, falling back to left alignment when the heading is too shortthis alignment is not widely supported. Examples of aligned headings are shown throughout this chapter. Note that HTML 4 recommends using a style sheet, rather than the ALIGN attribute, to define alignment. HR Element: Horizontal Rule
The empty HR element draws a horizontal line across the screen and is often used to divide sections within a single document. An <HR> terminates any preceding paragraph, so a new paragraph mark should follow an <HR> if there is subsequent text that is part of a paragraph. One common design is to place an <HR> at the bottom of a document, followed by an ADDRESS element containing address information for the document maintainer or owner. This is illustrated in Figures 6.7 through 6.10. HR supports the standard generic and event-handler attributes described earlier in this chapter. Note that the event handlers are only partially supported by Internet Explorer 4 and are not supported by Netscape Navigator 4. HR also supports several other attributes that define formatting properties of the rule. These attributes are:
|
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |