HTML and CSS Reference
In-Depth Information
ute is handy for creating a colored box behind text, as a highlighting or
attention-getting mechanism. It does, however, hide any layers below
it, including conventional HTML content.
The background attribute accepts the URL of an image as its value. The
image is tiled to fill the area occupied by the layer. If portions of the
image are transparent, those portions of the layer are transparent, and
underlying layers show through.
If you include both attributes, the background color shows through the
transparent spots in the background image. The whole layer is opaque.
The background attribute is useful for placing a texture behind text, but
it fails miserably when the goal is to render text in front of a fixed im-
age. Because the size of a layer is dictated by its contents, not the
background image, using the image as the background causes it to be
clipped or tiled, depending on the size of the text.
To place text reliably on top of an image, use one layer nested within
another:
<layer>
<img src="sunset.gif">
<p>
<layer top=75>
<h2 align=center>And they lived happily ever after...</h2>
</layer>
</layer>
Netscape 4 sets aside space for the entire image in the outer layer. The
inner layer occupies the same space, except that we shift it down 75
pixels to align the text better over the image. Figure H-11 shows the
result.
 
Search WWH ::




Custom Search