首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >水平图像的响应式图像叠加

水平图像的响应式图像叠加
EN

Stack Overflow用户
提问于 2015-10-14 13:08:57
回答 1查看 1.5K关注 0票数 16

我正在尝试为水平画廊中的响应式图像创建一个覆盖。li中的叠加div具有position和较大的z-index值,但仍显示在图像的背景上。当我尝试对具有较高z-index的图像执行absolute时,图像的水平滚动失败。

查看演示:Jsfiddle

代码语言:javascript
复制
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;
}
代码语言:javascript
复制
<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>

检查第二个图像。我已经在上面添加了覆盖。

EN

回答 1

Stack Overflow用户

发布于 2015-10-14 13:43:16

代码语言:javascript
复制
#thumbsList li {
    display: inline-block;
    position: relative;
}

你期待这样的结果吗?请参阅jsFiddle

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33117027

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档