NOTICE: This website is no longer updated or supported - as such many of the techniques used to build it may seem antiquated in the modern day. It is preserved for historical reasons only.

HTML XHTML The Complete Reference
home » reference » appendix a » html element reference

<layer> (Positioned Layer)


This Netscape-specific element allows the definition of overlapping content layers that can be exactly positioned, hidden or shown, rendered transparent or opaque, reordered front to back, and nested. The functionality of layers is available using CSS positioning facilities; page developers are advised not to use the <layer> element.

Syntax (Defined by Netscape 4 Only)


<layer
above="layer name"
background="URL of background image"
below="layer name"
bgcolor="color value"
class="class name(s)"
clip="clip region coordinates in x1, y1, x2, y2 form"
height="percentage | pixels"
id="unique alphanumeric identifier"
left="pixels"
name="string"
overflow="none | clip"
pagex="horizontal pixel position of layer"
pagey="vertical pixel position of layer"
src="url of layer's contents"
style="style information"
title="advisory text"
top="pixels"
visibility="hide | inherit | show"
width="percentage | pixels"
z-index="number"
</layer>

Element Specific Attributes


above
This attribute contains the name of the layer (as set with the name attribute) to be rendered directly above the current layer.

background
This attribute contains the URL of a background pattern for the layer. Like backgrounds for the document as a whole, the image might tile.

below
This value of this attribute is the name of the layer to be rendered below the current layer.

bgcolor
This attribute specifies a layer's background color. The attribute's value can be either a named color, such as red, or a color specified in the hexadecimal #RRGGBB format, such as #FF0000.

class
See "Core Attributes Reference," earlier in this appendix.

clip
This attribute clips a layer's content to a specified rectangle. All layer content outside that rectangle will be rendered transparent. The clip rectangle is defined by two x,y pairs that correspond to the top x, left y, bottom x, and right y coordinate of the rectangle. The coordinates are relative to the layer's origin point, 0,0 in its top-left corner, and might have nothing to do with the pixel coordinates of the screen.

height
This attribute is used to set the height of the layer either in pixels or as a percentage of the screen or region the layer is contained within.

left
This attribute specifies in pixels the left offset of the layer. The offset is relative to its parent layer, if it has one, or to the left browser margin if it does not.

name
This attribute assigns the layer a name that can be referenced by programs in a client-side scripting language. The id attribute also can be used.

overflow
This attribute specifies what should happen when the layer's content exceeds its rendering box and clipping area. A value of none does not clip the content, while clip clips the content to its dimensions or defined clipping area.

pagex
This attribute is used to set the horizontal pixel position of the layer relative to the document window rather than any enclosing layer.

pagey
This attribute is used to set the vertical pixel position of the layer relative to the document window rather than any enclosing layer.

src
This attribute specifies the URL that contains the content to include in the layer. Using this attribute with an empty element is a good way to preserve layouts under older browsers.

top
This attribute specifies in pixels the top offset of the layer. The offset is relative to its parent layer if it has one, or the top browser margin if it is not enclosed in another layer.

visibility
This attribute specifies whether a layer is hidden (hidden), shown (show), or inherits (inherit) its visibility from the layer enclosing it.

width
This attribute specifies a layer's width in pixels or as a percentage value of the enclosing layer or browser width.

z-index
This attribute specifies a layer's stacking order relative to other layers. Position is specified with positive integers, with "1" indicating the bottommost layer.

Examples


<layer name="scene" bgcolor="#00FFFF>
  <layer name="Shaq" left="100" top="100">
<img src="shaq.gif">
  </layer>

  <layer name="Rodman" left="200" top="100"
    visibility="hidden">
<img src="pinkhair.gif">
  </layer>
</layer>


<!-- The better way to do layers -->

<layer src="contents.htm" left="20" top="20"
  height="80%" width="80%">
</layer>

Compatibility


No Standards
Netscape 4, 4.5-4.8

Notes


Because this element is specific to Netscape 4, it should never be used and is discussed only for readers supporting existing <layer>-filled pages.

Applets, plug-ins, and other embedded media forms, generically called objects, can be included in a layer; however, they will float to the top of all other layers, even if their containing layer is obscured.

(X)HTML Elements
CSS Properties
Previous: label Next: legend
< Home | About | Chapters | Examples | Errata | Reference | Site Map >