我想像 { [DIV 1] [DIV 2] } 那样将 2 个 DIV 连续放置,但我遇到的问题是 div 的某些部分(背景)不会与其他部分(文本)一起移动。我能做些什么来修复它?
这是 DIV 的 CSS:
.container {
position:relative;
}
.content {
position:relative;
color:White;
z-index:5;
}
.background {
position:absolute;
top:0px;
left:0px;
width:35%;
height:100%;
background-color:Black;
z-index:1;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=50);
opacity:.5;
}
.container1{
position:relative;
}
.content1 {
position:relative;
color:White;
z-index:5;
}
.background1 {
position:absolute;
top:0px;
left:0px;
width:15%;
height:100%;
background-color:Black;
z-index:1;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=50);
opacity:.5;
}
这是 HTML 部分:
<div class="container">
<div class="content">
Random Content Here 1234556678
</div>
<div class="background"></div>
</div>
<div class="container1">
<div class="content1">
Other Random Content 1423563262
</div>
<div class="background1"></div>
</div>