Reputation: 909
I am trying to workout with HTML Layers. As far as I studied about layers, I was able to put text and images as layers with Z-Index concept. But, I want frames to be inserted as layers. For example, in gmail the background image is constant and the list of mails will be scrolling up and down. I could not understand how that happens.
I have used the following code for layering text and images -
<html>
<head>
<title>layers example</title>
</head>
<body><layer id="layer1" top="250" left="50" width="200"
height="200" bgcolor="red" src="http://www.bing.com">
<p>layer 1</p>
</layer>
<layer id="layer2" top="350" left="150" width="200"
height="200" bgcolor="blue" src="http://www.google.com">
<p><a href="http://www.google.com/">layer 2</a></p>
</layer>
<layer id="layer3" top="450" left="250" width="200"
height="200" bgcolor="green" src="http://www.yahoo.com">
<p>layer 3</p>
<div style="position:relative; font-size:50px; z-index:1;"><img src="http://t2.gstatic.com/images?q=tbn:ANd9GcQ6J6SpArkOxpmJnTYWEhpHVBblK6QaEklttBWfamorUYuMCob42A"></div>
<div style="position:relative; top:-50; left:5; color:red; font-size:80px; z-index:2"><img src="http://t1.gstatic.com/images?q=tbn:ANd9GcTZc0IWj3c3KTndAIy7-3SHhuur4z3Dzufa31xQf4csrZmDvm-e0A"></div>
<div style="position:relative; top:-50; left:5; color:red; font-size:80px; z-index:2"><img src="http://t2.gstatic.com/images?q=tbn:ANd9GcRvqc6p-sUKBtmYUrp4tIGqjXfXOGExoGkpZvLxTPcVGZRMc4iN"></div>
<div id="Layer1" style="position:absolute;width:300px;height:75px;left:54px;background-color:green"><b>This is layer1</b></div>
<div id="Layer2" style="position:absolute;width:200px;height:65px;left:54px;background-color:orange;border:1px"><b>This is layer2</b></div>
</layer>
</body>
</html>
If any one have idea about that, please share with me.
Thanks in advance.
Upvotes: 0
Views: 363
Reputation: 18123
A fixed background doesn't require layers. You can set it to your body:
body {
background: #000000 url(image.jpg) top center no-repeat fixed;
}
Upvotes: 0
Reputation: 2642
.YourClass{
background:url("images/yourBackgroundImagePath") no-repeat ;
background-attachment:fixed;}
Upvotes: 1