Chapter 9. Structural HTML Tags
This chapter
looks at the subset of HTML tags that is used primarily to give the
document structure. It also discusses tags that are used for
providing information about the document and those used for
controlling its appearance or function on a global level.
9.1. Summary of Structural Tags
In this section, browser support for each tag is noted to the right
of the tag name. Browsers that do not support the tag are grayed out.
Tag usage is indicated below the tag name. Start and end tags are
required unless otherwise noted. "Deprecated" means that
the tag or attribute is currently supported but is due to be phased
out of the HTML specification and is discouraged from use (usually in
favor of similar style sheet controls). The attributes listed for
each tag reflect those in common use. A more thorough listing of
attributes for each tag, according to the HTML 4.01 specification,
appears in Appendix A, "HTML Elements".
<body> | NN 2, 3, 4, 6 MSIE 2, 3, 4, 5, 5.5, 6 HTML 4.01 WebTV Opera5 |
<body>...</body> (start and end tags optional) | |
Defines the beginning and the end of the document body. The body
contains the content of the document (the part that is displayed in
the browser window). Attributes to the
<body> tag affect the entire document.
Attributes
- alink="#rrggbb" or color name
-
Deprecated. Sets the color of active links
(i.e., the color while the mouse button is held down during a
"click"). Color is specified in hexadecimal RGB values or
by standard web color name. Chapter 16, "Specifying Color in HTML" explains
these color specification methods.
- background=url
-
Deprecated. Provides the URL to a graphic file
to be used as a tiling graphic in the background of the document.
- bgcolor="#rrggbb" or color name
-
Deprecated. Sets the color of the background for
the document. Color is specified in hexadecimal RGB values or by
standard web color name.
- link="#rrggbb" or color name
-
Deprecated. Sets the default color for all the
links in the document. Color is specified in hexadecimal RGB values
or by standard web color name.
- text="#rrggbb" or color name
-
Deprecated. Sets the default color for all the
non-hyperlink and unstyled text in the document. Color is specified
in hexadecimal RGB values or by standard web color name.
- vlink="#rrggbb" or color name
-
Deprecated. Sets the color of the visited links
(links that have already been followed) for the document. Color is
specified in hexadecimal RGB values or by standard web color name.
Netscape Navigator 4.0+ only
- marginwidth=number
-
Specifies the distance (in number of pixels) between the left and
right browser edges and the text and graphics in the window.
- marginheight=number
-
Specifies the distance (in number of pixels) between the top and
bottom edges of the browser and the text or graphics in the window.
Internet Explorer only
- bgproperties=fixed
-
When this attribute is set to fixed, the
background image does not scroll with the document content.
- leftmargin=number
-
Specifies the distance (in number of pixels) between the left browser
edge and the beginning of the text and graphics in the window.
- topmargin=number
-
Specifies the distance (in number of pixels) between the top edge of
the browser and the top edge of the text or graphics in the window.
- rightmargin=number
-
Specifies the distance (in number of pixels) between the right edge
of the browser and the text or graphics in the window.
- bottommargin=number
-
Specifies the distance (in number of pixels) between the bottom edge
of the browser and the bottom edge of the text or graphics in the
window.
<head> | NN 2, 3, 4, 6 MSIE 2, 3, 4, 5, 5.5, 6 HTML 4.01 WebTV Opera5 |
<head>...</head> (start and end tags optional) | |
Defines the head (also called "header") portion of the
document that contains information about the document. The
<head> tag has no directly displayed
content, but serves only as a container for the other header tags,
such as <base>,
<meta>, and
<title>.
Attributes
- profile=URL
-
Provides the location of a predefined metadata profile that can be
referenced by <meta> tags in the
<head> of the document. This attribute is
not yet implemented by browsers.
<html> | NN 2, 3, 4, 6 MSIE 2, 3, 4, 5, 5.5, 6 HTML 4.01 WebTV Opera5 |
<html>...</html> (start and end tags optional) | |
Placed at the beginning and end of the document, this tag tells the
browser that the entire document is composed in HTML.
Attributes
- dir=ltr|rtl
-
Indicates the direction the text should be rendered by the browser.
The default is ltr (left-to-right), but some
languages require rtl (right-to-left) rendering.
The lang and dir attributes are
part of the internationalization efforts incorporated into the HTML
4.01 specification. They can be added to almost any HTML element, but
their use in the <html> tag is common for
establishing the language for a whole document. For more information,
see Chapter 7, "Internationalization".
- lang=language code
-
Indicates the primary language of the document (see Chapter 7, "Internationalization" for more information and language codes).
- version="-//W3C//DTD HTML 4.01//EN"
-
Deprecated. Specifies the version of HTML the
document uses (the value above specifies 4.01). It has been
deprecated in favor of the SGML <!DOCTYPE>
declaration placed before the <html> tag.
<meta> | NN 2, 3, 4, 6 MSIE 2, 3, 4, 5, 5.5, 6 HTML 4.01 WebTV Opera5 |
<meta> (end tag forbidden) | |
Provides additional information about the
document. It should be placed within the
<head> tags at the beginning of the
document. It is commonly used for making documents searchable (by
adding keywords) or to specify the character set for a document. They
have been used for client-pull functions, but this function is
discouraged. Meta tags are discussed at the end of this chapter.
Attributes
- content=text
-
Required. Specifies the value of the meta tag
property and is always used in conjunction with
name= or http-equiv=.
- http-equiv=text
-
The specified information is treated as though it were included in
the HTTP header that the server sends ahead of the document. It is
used in conjunction with the content attribute (in
place of the name attribute).
- name=text
-
Specifies a name for the meta information property.
- scheme=text
-
Provides additional information for the interpretation of meta data.
This is a new attribute introduced in HTML 4.0.
<title> | NN 2, 3, 4, 6 MSIE 2, 3, 4, 5, 5.5, 6 HTML 4.01 WebTV Opera5 |
Required. Specifies the title of the document.
The title generally appears in the top bar of the browser window.
According to the HTML 4.01 specification, all documents must contain
a meaningful <title> within the
<head> of the document.
| | | 8.7. HTML Resources in This Book | | 9.2. Setting Up an HTML Document |
Copyright © 2002 O'Reilly & Associates. All rights reserved.
|
|