我在页面上有不同的部分。然后我在这些部分下修复了一个图像。然后我的上一节有很大的余量,所以当用户向下滚动时,它们会看到图像并且会给它带来3d效果。我的问题是我的#vanishing-text-container
div没有显示在图像上。我不确定为什么因为我添加了z-index
的1,它高于图像。
有没有人知道为什么我的#vanishing-text-container
div没有显示在图片上?
#safety-boxes, #scrolling-content, #safety-content {
width: 100%;
}
/*---Safety Boxes----*/
#safety-boxes {
/*height: 400px;*/
height: 50%;
position: relative;
z-index: 2;
}
#safety-box-large, .safety-box-small {
vertical-align: top;
}
#safety-box-large {
width: 50%;
height: 100%;
display: inline-block;
background: #FF2F2F;
}
.safety-box-small {
width: 25%;
height: 100%;
display: inline-block;
}
#safety-box2 {
background: #3e745b;
}
#safety-box3 {
background: #6f9697;
}
.safety-box-icon {
height: 150px;
width: 150px;
display: block;
margin: 0 auto;
padding: 80px 0 60px 0;
}
.safety-box-title {
color: #FFF;
font-size: 2.5em;
font-family: 'open_sanslight', "Droid Sans", sans-serif;
text-align: center;
line-height: 1.4em;
padding: 5px 8px;
}
/*----Vanishing Text ---*/
#vanishing-text-container {
width: 100%;
height: 50%;
background: #FFF;
z-index: 1;
}
#vanishing-text {
position: relative;
padding-top: 150px;
font-size: 3em;
line-height: 1.4em;
text-align: center;
}
/*---Scrolling Section---*/
#scrolling-content {
position: fixed;
top: 0;
left: 0;
/* background: green;*/
height: 400px;
}
#scrolling-content-container {
padding-top: 150px;
width: 100%;
}
#safety-main-img {
width: 100%;
height: auto;
}
#scrolling-content-description {
text-align: center;
/*position: absolute;
top: 80%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);*/
font-size: 3em;
line-height: 1.4em;
color: #FFF;
}
/*---Safety Content ---*/
#safety-content {
margin-top: 300px;
background: #EDEDED;
height: 500px;
position: relative;
z-index: 2;
}
#safety-content-container {
padding: 100px 15%;
}
#safety-content-description {
font-size: 1.5em
line-height: 1.4em;
}

<div id="safety-boxes">
<div id="safety-box-large">
<img src="images/safety/head-protection.png" class="safety-box-icon" alt="Demolition and Wrecking Safety">
<div class="safety-box-title">Safety is a top priority</div>
</div><div class="safety-box-small" id="safety-box2">
<img src="images/safety/shield.png" class="safety-box-icon" alt="The Eslich Wrecking Company Safety">
<div class="safety-box-title">Safety Training</div>
</div><div class="safety-box-small" id="safety-box3">
<img src="images/safety/wrench.png" class="safety-box-icon" alt="Demolition and Wrecking Company Safety">
<div class="safety-box-title">Right tools for the job</div>
</div>
</div>
<div id="vanishing-text-container">
<div id="vanishing-text">THE COMPANY PUTS SAFETY FIRST</div>
</div>
<div id="scrolling-content">
<div id="scrolling-content-container">
<!-- <div id="scrolling-content-description">WE CARE ABOUT THE SAFETY AND WELL BEING OF ALL LIVES</div> -->
<img src="http://optimumwebdesigns.com/eslich/images/safety/safety-main.jpg" alt="The Eslich Wrecking Company Promotes Safety Demolition" id="safety-main-img">
</div>
</div>
<div id="safety-content">
<div id="safety-content-container">
<div id="safety-content-description">Safety</div>
</div>
</div>
&#13;
答案 0 :(得分:3)
你在#消失文本容器上缺少某种位置。如果没有职位,z-index将无效。
这应该解决它。