我正在尝试为水平画廊中的响应式图像创建一个覆盖。li
中的叠加div
具有position
和较大的z-index
值,但仍显示在图像的背景上。当我尝试对具有较高z-index
的图像执行absolute
时,图像的水平滚动失败。
查看演示:Jsfiddle
html,
body {
min-height: 100%;
height: 100%;
}
body {
width: 100%;
margin: 0;
padding: 0;
}
#thumbsList {
height: 76%;
white-space: nowrap;
margin: 0;
padding: 0;
line-height: 0px;
top: 13%;
left: 80px;
list-style-type: none;
top: 13%;
position: absolute;
}
#thumbsList li {
display: inline;
position: relative;
}
#thumbsList li img {
max-width: 100%;
height: 100%;
transition: all 0.8s ease;
}
.Absolute-Center {
margin: auto;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
.backStrip {
background-color: #2d2d2d;
border-bottom: 1px solid #1a1a1a;
height: 35px;
position: relative;
z-index: 22;
position: fixed;
width: 253px;
top: 43px;
height: 79px;
left: 85px;
}
#infoText {
color: white;
font-style: italic;
padding-top: 10px;
float: right;
margin-right: 10px;
font-family: sans-serif;
font-size: 12px;
}
#mainContainer {
height: 100%;
width: 100%;
position: fixed;
z-index: 1;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
border: 8px solid #2D2D2D;
margin: 0px;
overflow-x: auto;
}
#thumbsButtons {
list-style: none;
position: fixed;
bottom: 6%;
left: 46%;
z-index: 22;
}
#counterContainer {
position: fixed;
bottom: 5%;
left: 50%;
right: 50%;
font-family: verdana;
font-weight: bold;
width: 100px;
}
#thumbsButtons li {
float: left;
margin-left: 11px;
font-size: 16px;
font-family: verdana;
}
#thumbsButtons li:hover {
cursor: pointer;
}
#nextArrow {
position: fixed;
right: 10px;
top: 43%;
z-index: 13333;
font-size: 100px;
color: white;
font-family: helvetica;
cursor: pointer;
}
#sidelogo {
position: absolute;
z-index: 10;
top: 35%;
left: 0%;
width: 67px;
height: 258px;
background-color: #2D2D2D;
}
.headerInfo {
position: absolute;
bottom: 22px;
color: white;
z-index: 333;
font-family: verdana;
font-size: 17px;
text-align: center;
}
.thumbOverlay {
position: absolute;
z-index: 13111133;
background-color: black;
color: white;
height: 100%;
width: 100%;
left: 0px;
top: 0px;
display: inline;
}
<div id="mainContainer">
<div class="backStrip"> <span id="infoText">Written By Banmeet Singh</span>
</div>
<ul id="thumbsButtons"></ul> <span id="nextArrow">></span>
<span id="sidelogo">Thinking Forward</span>
<ul id="thumbsList">
<li>
<img class="forward" src="http://placehold.it/350x150" alt="Alternate Text" /> <span class="headerInfo">Josh Kloss</span>
</li>
<li>
<div class="thumbOverlay"><span>adasd</span>
</div>
<img class="forward" src="http://placehold.it/350x150" alt="Alternate Text" />
</li>
<li>
<img class="forward" src="http://placehold.it/350x150" alt="Alternate Text" />
</li>
<li>
<img class="forward" src="http://placehold.it/200x100" alt="Alternate Text" />
</li>
<li>
<img class="forward" src="http://placehold.it/350x150" alt="Alternate Text" />
</li>
<li>
<img class="forward" src="http://placehold.it/200x100" alt="Alternate Text" />
</li>
</ul>
<div id="counterContainer">3 of 10</div>
检查第二个图像。我已经在上面添加了覆盖。
发布于 2015-10-14 13:43:16
#thumbsList li {
display: inline-block;
position: relative;
}
你期待这样的结果吗?请参阅jsFiddle
https://stackoverflow.com/questions/33117027
复制相似问题