W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n

<LAYER>...</LAYER>

Description

This description is taken from the Netscape description of the element.

With this element you can create several layers of content on a page. These layers can be stacked on top of each other, showing parts of underlying layers through non-occupied space. You can control the order of the layers, the position on the page and if a layer is visible or not.
The difference between the LAYER element and the ILAYER element is that a layer defined with the LAYER element is positioned relative to the containing layer, or the document if it is the top layer. The position of a layer defined by an ILAYER element is the natural position in the flow of the text, just like an image.

Attributes

W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n
ABOVE
This attribute controls the stacking of the layers, in relation to other layers. With it you specify which layer is positioned immediately above the layer being defined. The value supplied must be the NAME of that layer.

The attributes ABOVE, BELOW and Z-INDEX are mutually exclusive, so if you use this attribute, the attributes BELOW and Z-INDEX cannot be used.


W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n
BACKGROUND
Supply an image that is used as the background of the layer. If the space that the layer occupies is larger than the image, the image is tiled to fill up the used space. You can use images in the GIF and JPEG format.
If you use an transparent image the transparent parts will be shown in the background color, or the HTML elements of underlying layers.
W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n
BELOW
This attribute controls the stacking of the layers, in relation to other layers. With it you specify which layer is positioned immediately below the layer being defined. The value supplied must be the NAME of that layer.

The attributes ABOVE, BELOW and Z-INDEX are mutually exclusive, so if you use this attribute, the attributes ABOVE and Z-INDEX cannot be used.


W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n
BGCOLOR
Set the background color of the layer, hiding all elements of layers below it.
See the page Using colors for a description on specifying colors.
W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n
CLIP
This attribute determines the clipping rectangle of the layer, that is, it defines the boundaries of the visible area of the layer.

The value is a set of 4 numbers, indicating in order, the left value, the top value, the right value, and the bottom value. The left and right values are specified as pixels in from the left, while the top and bottom values are specified as pixels down from the top of the containing document or layer.

Each of the 4 values are numbers of pixels. You can also specify the value as a set of 2 numbers, in which case the left and top values default to 0. For example:

clip="10,20"

is equivalent to

clip="0,0,10,20"

If you do not supply this attribute, the clipping rectangle of a layer is determined by the values of WIDTH and HEIGHT. By default, a layer expands to contain all of its content.


W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n
HEIGHT
The HEIGHT parameter determines the initial height of the clipping region of the layer. The height can be expressed as an integer pixel value, or as a percentage of the height of the containing layer (or the window for a top-level layer.)

Note however that if the contents of the layer do not fit inside the specified height, the layer will expand its height to include all its contents.

The main purpose of the HEIGHT attribute is to act as the reference height for attribute values in its children layers that are specified using percentages.

This attribute is optional; by default, the layer height is the minimum height that contains all the layer contents.


W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n
ID
Description of the ID attribute
W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n
LEFT
The LEFT parameter specifies the horizontal position of the top left corner of the layer within its containing layer, or within the document if it is at the top level. The attribute is optional. The default value is the horizontal position of the element's contents as if they were not enclosed in a layer.

For positioned layers the origin is the upper-left-hand corner of the document or containing layer, with coordinates increasing downwards and to the right.


W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n
NAME
The NAME parameter is an identification element for the layer. The NAME must begin with an alphabetic character. (The NAME parameter is the same as the ID parameter.)

You can use the layer's name to refer to the layer from within HTML and external scripting languages such as JavaScript.

This attribute is optional; by default, layers are unnamed.


W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n
ONBLUR
This is an event handler. The value must be a function or inline Javascript code. The onBlur handler is invoked when the layer loses keyboard focus.
W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n
ONFOCUS
This is an event handler. The value must be a function or inline Javascript code. The onFocus handler is invoked the layer gets keyboard focus.
W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n
ONLOAD
This is an event handler. The value must be a function or inline Javascript code. The onLoad handler is invoked when the layer is loaded, regardless of whether the layer is visible or not.
W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n
ONMOUSEOUT
This is an event handler. The value must be a function or inline Javascript code. The onMouseOut handler is invoked when the mouse leaves the layer.
W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n
ONMOUSEOVER
This is an event handler. The value must be a functions or inline Javascript code. The onMouseOver handler is invoked when the mouse enters the layer.
W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n
PAGEX
The PAGEX parameter specifies the horizontal position of the top left corner of the layer relative to the enclosing document (rather than the enclosing layer.)
W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n
PAGEY
The PAGEY parameter specifies the vertical position of the top left corner of the layer relative to the enclosing document (rather than the enclosing layer.)
W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n
SRC
The SRC parameter specifies an external file that contains HTML-formatted text to be displayed in this layer.

The file specified by SRC can contain an arbitrary HTML document.

The source file can include JavaScript code. Any LAYER elements in the source file will be treated as child layers of the layer for which the source file is providing content.

The SRC parameter is particularly useful if you want to dynamically change the content of the layer. For example, a restaurant might have a web page that uses a layer to describe the special meal of the day. Each morning, after the chef has decided what the special is going to be for the day, he or she quickly edits the file "special.htm" to describe the meal.

The chef doesn't have to re-write the entire page just to update the information about the special of the day.


W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n
TOP
The TOP parameter specifies the vertical position of the top left corner of the layer within its containing layer, or within the document if it is at the top level. This attribute is optional. The default value is the vertical position of the element's contents as if they were not enclosed in a layer.

For positioned layers the origin is the upper-left-hand corner of the document or containing layer, with coordinates increasing downwards and to the right.


W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n
VISIBILITY
The VISIBILITY parameter determines whether the layer is visible or not. A value of HIDE hides the layer; SHOW shows the layer; INHERIT causes the layer to have the same visibility as its parent layer. For top level layers (that is, layers that are not nested inside other layers, a value of INHERIT has the same effect as SHOW since the body document is always visible.)

This attribute is optional. By default, a layer has the same visibility as its parent layer, that is, the value of the VISIBILITY attribute is INHERIT.

Remember that even if the visibility of a layer is set to SHOW, you will only be able to see the layer if there are no other visible, opaque layers stacked on top of it.


W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n
WIDTH
The WIDTH parameter determines the width of the layer. The width can be expressed as an integer pixel value, or as a percentage of the width of the containing layer.

Note however that if the elements that cannot be wrapped, such as images, extend beyond the width specified, the actual width of the contents of the layer will expand accordingly.

This attribute is optional; by default, the layer contents wrap at the right boundary of the enclosing layer.


W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n
Z-INDEX
This attribute controls the stacking of the layers, in relation to other layers. With it you specify at which position in the stack of layers you want to put the layer that you are creating. The number you supply is relative to the parent layer, that is, the layer in which this layer is defined. A positive value stacks the layer above the parent layer, a negative value below it.

The attributes ABOVE, BELOW and Z-INDEX are mutually exclusive, so if you use this attribute, the attributes ABOVE and BELOW cannot be used.

Examples

Source
<A href="LAYER1.html">Take a look at the LAYER example</A>
 
Result
Take a look at the LAYER example
Statistics