Professional Documents
Culture Documents
Layers of Netscape
Layers of Netscape
<head>
<title>HTML layer Tag</title>
</head>
<body>
<layer id = "layer1" top = "250" left = "50" width = "200"
height = "200" bgcolor = "red">
<p>layer 1</p>
</layer>
<layer id = "layer2" top = "350" left = "150" width = "200"
height = "200" bgcolor = "blue">
<p>layer 2</p>
</layer>
<layer id = "layer3" top = "450" left = "250" width = "200"
height = "200" bgcolor = "green">
<p>layer 3</p>
</layer>
</body>
</html>
Most important layer attributes below:
id
The name of the layer, used to identify it in your script
left
The position of the layer in relationship to the x coordinates
top
The position of the layer in relationship to the y coordinates
width
The width of the layer, in px or %
height
The height of the layer, in px or %
bgColor
The background color of the layer
background
The background image of the layer
src
The external html document contained inside the layer
Normally the browser maintains the content as a stack of layers. The z-index
property specifies the stack order of an element. An element with greater stack order is
always in front of an element with a lower stack order.
The z-index property, when used in conjunction with the position property,
enables you to specify which element should appear on top in the event of an
overlap. An overlap can easily occur when using the position property and this is
often desirable when creating advanced layouts.
<html>
<head>
<title> Layer effect example </title>
</head>
<body>
LAYER 1 ON TOP:
<div style="position:relative; font-size:50px; z-index:2;">LAYER 1</div>
<div style="position:relative; top:-50; left:5; color:red; font-size:80px; z-
index:1">LAYER 2</div>
LAYER 2 ON TOP:
<div style="position:relative; font-size:50px; z-index:3;">LAYER 1</div>
<div style="position:relative; top:-50; left:5; color:red; font-size:80px; z-
index:4">LAYER 2</div>
</body>
</html>
NOTE