我是一名程序员,学习web开发中的新技术。如果您可以查看下面的链接,我遇到了问题。 http://bailesslaw.com/Bailess_003/bailesHeader/header.html 我给出的这个例子没有固定,它需要变得越来越困难。在CSS中重叠和堆叠
这看起来不错,但是当我将这些图层放在主网站index.html上时,将此代码作为标题,横幅在文档位置0,0中移动。我需要固定这些框,中间页面,我不能让它们做到这一点,而不会搞乱图层顺序和内容。
Layer1的旋转图像,JS使旋转 二层蓝色三角形与背景效果重叠层1, 三层技术是具有高的z-index
下面我包括一些代码,所述静态图像重要的部分,需要3个重叠的层完全匹配的宽度和高度,除了它必须固定在中心780px宽。
代码:
<style rel="stylesheet" type="text/css">
div#layer1 {
border: 1px solid #000;
height: 200px;
left: 0px;
position: fixed;
top: 0px;
width: 780px;
z-index: 1;
}
div#layer2 {
border: 1px solid #000;
height: 200px;
left: 0px;
position: absolute;
top: 0px;
width: 780px;
z-index: 2;
}
div#layer3 {
border: 1px solid #000000;
height: 200px;
left: 0px;
position: absolute;
top: 0px;
width: 780px;
z-index: 3;
}
</style>
</head>
<body class="oneColFixCtr">
<div id="container">
<div id="mainContent">
<div id="layer1">
</div>
<div id="layer2">
<div class="slideshow">
<span id="rotating1">
<p class="rotating">
</p>
</span>
<span id="rotating2">
<p class="rotating">
</p>
</span>
<span id="rotating3">
<p class="rotating">
</p>
</span>
<span id="rotating4">
<p class="rotating">
</p>
</span>
</div>
</div>
<div id="layer3">
<table width="385" border="0">
<tr>
<th width="81" scope="col">
</th>
<th width="278" scope="col">
</th>
<th width="12" scope="col">
</th>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
</div>
</div>
<!-- end #container -->
</div>
</body>
</body>
</html>
CSS:
@charset "utf-8";
CSS code:
#rotating1 {
height: 200px;
width: 780px;
}
#rotating2 {
height: 200px;
width: 780px;
}
#rotating3 {
height: 200px;
width: 780px;
}
#main {
background-repeat: no-repeat;
height: 200px;
width: 780px;
z-index: 100;
}
#test {
width: 780px;
z-index: 2;
}
#indexContent {
background-color: #12204d;
background-repeat: no-repeat;
height: 200px;
width: 780px;
z-index: 1;
}
#indexContent p {
padding: .5em 2em .5em 2em;
text-align: justify;
text-indent: 2em;
}
.rotating {
float: right;
margin-top: 227px;
text-indent: 0px !important;
}
.clearfix:after {
clear: both;
content: " ";
display: block;
font-size: 0;
height: 0;
visibility: hidden;
}
.clearfix {
display: inline-block;
}
* html .clearfix {
height: 1%;
}
.clearfix {
display: block;
}
请设置一个的jsfiddle @ http://jsfiddle.net/ – PeeHaa 2011-01-09 03:23:19