屏幕幻灯片高度

时间:2017-05-13 12:19:43

标签: html css

所以我使用html和css制作了一个网页,它由四张幻灯片组成。菜单位于顶部(标题),单击每个元素即可显示幻灯片。

每张幻灯片都有视频背景。

每张幻灯片的内容由div(左边一张,右边一张等)制作,div有文字或图片。内容滚动,视频保持固定。

一切都很好,但我的主要问题是每张幻灯片的高度取决于内容最长的幻灯片的高度。因此,我的4张幻灯片中有3张在结尾处有一个空白区域。

这是我的html文档正文:

  html,
body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
}

.wrap {
  height: 100%;
  width: 100%;
  position: relative;
  -ms-overflow-style: none;
  overflow: scroll;
  overflow-x: hidden;
  background: #120103;
  color: #fff;
  text-align: center;
}

header {
  background: #060523;
  box-shadow: 0 .5em 1em #111;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 900;
  width: 100%;
  opacity: 0.9;
}

header label {
  color: #788188;
  cursor: default;
  display: inline-block;
  line-height: 4.25em;
  font-size: .667em;
  font-weight: bold;
  padding: 0 1em;
}

header label:hover {
  background: #0b0a3f;
  height: inherit;
}

.slide {
  height: 200%;
  width: 100%;
  position: absolute;
  top: 0;
  left: 100%;
  z-index: 20;
  padding: 0;
  background-attachment: fixed;
  background-color: #120103;
  background-position: 50% 50%;
  background-size: cover;
  transition: left 0s .75s;
}

.vidwrap {
  position: fixed;
}

#video_bg_elem {
  position: absolute;
  height: 900px;
  width: 1440px;
}

.content {
  position: absolute;
  min-width: 100%;
  min-height: 100%;
  z-index: 1000;
  background-color: transparent;
  opacity: 0.4;
}

.div1 {
  margin-left: 15px;
  float: left;
  word-wrap: break-word;
  width: 49%;
  height: auto;
  display: inline-block;
}

.div2 {
  float: right;
  word-wrap: break-word;
  width: 49%;
  height: auto;
  display: inline-block;
}

img {
  border: 1px solid white;
  display: inline;
  vertical-align: top;
  white-space: nowrap;
}

.slide-one {
  height: auto;
}

.slide-two {
  height: auto;
}

.slide-three {
  height: auto;
}

.slide-four {
  height: auto;
}

[id^="slide"]:checked+.slide {
  left: 0;
  z-index: 100;
  transition: left .65s ease-out;
}

.slide h1 {
  opacity: 0;
  transform: translateY(100%);
  transition: transform .5s .5s, opacity .5s;
}

[id^="slide"]:checked+.slide h1 {
  opacity: 1;
  transform: translateY(0);
  transition: all .5s .5s;
}

.slide p {
  opacity: 0;
  transform: translateY(100%);
  transition: transform .5s .5s, opacity .5s;
}

[id^="slide"]:checked+.slide p {
  opacity: 1;
  transform: translateY(0);
  transition: all .5s .5s;
  .slide img {
    opacity: 0;
    transform: translateY(100%);
    transition: transform .5s .5s, opacity .5s;
  }
  [id^="slide"]:checked+.slide p {
    opacity: 1;
    transform: translateY(0);
    transition: all .5s .5s;
  }
<div class="wrap">
  <header>
    <label for="slide-1-trigger">1</label>
    <label for="slide-2-trigger">2</label>
    <label for="slide-3-trigger">3</label>
    <label for="slide-4-trigger">4</label>
  </header>
  <input id="slide-1-trigger" type="radio" name="slides" style="display:none;" checked>
  <section class="slide slide-one">
    <div class="vidwrap">
      <video id="video_bg_elem" preload="auto" autoplay="true" loop="loop" muted="muted">
                            <source src="vid/1.mp4">
                            </video>
    </div>
    <br>
    <h1>Title 1</h1>
    <div>
      <div class="div1">
        <p>Text</p>
        <br>
        <br>
        <br>
        <br>
        <br>
        <br>
      </div>
      <div class="div2">
        <br>
        <br>
        <p><img src="Images/1.jpg" width="512" height="320"></p>
        <br>
        <br>
      </div>
      <div class="div1">
        <p>Text</p>
        <br>
        <br>
        <br>
        <br>
        <br>
        <br>
      </div>
      <div class="div2">
        <p><img src="Images/2.jpg" width="320" height="320"></p>
      </div>
      <div class="div1">
        <p>Text</p>
        <br>
        <br>
        <br>
        <br>
        <br>
        <br>
      </div>
      <div class="div2">
        <br>
        <br>
        <p><img src="Images/3.jpg" width="320" height="320"></p>
        <br>
        <br>
      </div>
      <div class="div1">
        <p>Text</p>
        <br>
        <br>
        <br>
        <br>
        <br>
        <br>
      </div>
      <div class="div2">
        <br>
        <br>
        <p><img src="Images/4.jpg" width="320" height="320"></p>
        <br>
        <br>
      </div>
    </div>
  </section>
  <input id="slide-2-trigger" type="radio" name="slides" style="display:none;">
  <section class="slide slide-two">
    <div class="vidwrap">
      <video id="video_bg_elem" preload="auto" autoplay="true" loop="loop" muted="muted">
                            <source src="vid/2.mp4">
                            </video>
    </div>
    <br>
    <br>
    <h1>Title</h1>
    <div>
      <div class="div1">Left Text</div>
      <div class="div2">Right Text</div>
    </div>
  </section>
  <input id="slide-3-trigger" type="radio" name="slides" style="display:none;">
  <section class="slide slide-three">
    <div class="vidwrap">
      <video id="video_bg_elem" preload="auto" autoplay="true" loop="loop" muted="muted">
                            <source src="vid/3.mp4">
                            </video>
    </div>
    <h1>Title</h1>
  </section>
  <input id="slide-4-trigger" type="radio" name="slides" style="display:none;">
  <section class="slide slide-four">
    <div class="vidwrap">
      <video id="video_bg_elem" preload="auto" autoplay="true" loop="loop" muted="muted">
                            <source src="vid/4.mp4">
                            </video>
    </div>

  </section>

为了让每张幻灯片上的特定高度,而不是最长幻灯片的高度,我修改了什么? 我试过身高:自动但是没用。

0 个答案:

没有答案