[Contents] [Prev page] [Next page] [Last page]

Part 2. Using the <LAYER> Tag

Overview of the <LAYER> Tag

The <LAYER> tag starts a layer, and the </LAYER> ends the layer. All the HTML content between the opening and closing layer tag can be treated as a single item of content that can be moved and altered in various ways. For example, you could have many overlapping layers that can be dynamically peeled away to reveal the layer underneath.

Using JavaScript, you can dynamically change whether a layer is visible or not, which means you can hide a layer and make it reappear again if you want.

Layers have a stacking order that determine which layer appears on top of another for overlapping layers. You can specify the "stacking order" (Z order) of layers as relative to each other (Layer A is immediately below Layer B) or you can specify numerical Z orders (the Z value of Layer A is 1, the Z order of Layer B is 2.)

Layers can be transparent or opaque. If a layer is transparent, the content of underlying layers shows through it. You can specify background images and background colors for layers just as you can for the body of an HTML document. If you set the background image or color, however, the layer will not be transparent, and it will obscure any layers that lie below it.

Layers can be nested inside layers, so you can have a layer containing a layer containing a layer and so on.

You can define layers that have explicit positions, and you can define layers whose position follows the natural flow of the page. A layer that is explicitly positioned is known as a positioned or out-of-flow layer, while a layer that follows the natural flow of the page is known as an inflow layer.

To create a positioned layer, use the <LAYER> tag with a corresponding </LAYER> tag to identify the end of the layer. To create an inflow layer, use the <ILAYER> tag with a closing </ILAYER> tag.

[Contents] [Prev page] [Next page] [Last page]

Copyright © 1997, Netscape Communications. All rights reserved.