HTML and CSS Reference
In-Depth Information
5.3.1.8. The style and class attributes
You also can set all the various style-related <body> features, and then
some, with CSS. But although you may include the style attribute with
the <body> tag to create an inline style for the entire document body, we
recommend that you set those styles at the document level (using the
<style> tag inside the document head) or via a collection-level (impor-
ted) stylesheet.
Use the class attribute and name value to apply the appropriate style
of a predefined class of the <body> tag to the contents. (Because there
can be only one body per document, what is the point of setting a class
name otherwise?) We cover the use of style and class definitions in
Chapter 8 .
5.3.1.9. Mixing and matching body attributes
Although background and bgcolor attributes can appear in the same
<body> tag, a background image will effectively hide the selected back-
ground color unless the image contains substantial portions of transpar-
ent areas, as we described earlier in this chapter. But even if the image
does hide the background color, go ahead and include the bgcolor attrib-
ute and some appropriate color value. Users can turn off image down-
loading, which includes background images, so otherwise they may find
your page left naked and unappealing. Moreover, without a bgcolor at-
tribute or a downloaded (for whatever reason) background image, the
browsers merrily ignore your text and link color attributes, too, revert-
ing instead to their own default values or the ones the user has chosen.
5.3.2. Extending a Warning
Much like early users of the Macintosh felt compelled to create docu-
ments using ransom-note typography ("I've got 40 fonts on this thing,
and I'm going to use them all!"), many authors cannot avoid adding
some sort of textured background to every document they create ("I've
 
Search WWH ::




Custom Search