文本显示在标题而不是新的BS4部分

时间:2017-06-03 20:36:40

标签: html css twitter-bootstrap bootstrap-4

我的单页网站存在问题。我的新文字部分显示在我的标题视频中。而是在我的新部分。我希望它在视频标题之后。我做错了什么?

我的HTML

<header>
<div class="container">
  <div class="bg-wrap">

      <video poster="poster.png" autoplay="true" loop muted>
      <source src="img/video.mp4" type="video/mp4">
      <source src="img/video.webm" type="video/webm">
    </video>

    <div class="header-text">
      <h1>Elektro Sikora</h1>
      <p>Informační portál Elektro Sikora Český Těšín</p>
    </div>

    <div id="scroll">
      <div class="round">
        <div class="wheel"></div>
      </div>
      <div class="scrolling">
        <span class="arrow"></span>
      </div>
    </div>
  </div>
  </div>
</header>

  <section id="content-space">
    <div class="container">
      <div class="row">
        <div class="col-lg-12 text-center">
          <p>
            Kompletní nabídka produktů, které nabízíme. Najdete zde od elektroniky až po zdravou výživu.
          </p>
        </div>
      </div>
    </div>
  </section>

我的CSS

/* Nav */
.navbar {
  padding: 1,2rem;
}
/* Video */
.bg-wrap {
  position: fixed;
  z-index: -1000;
  width: 100%;
  height: 100%;
  overflow: hidden;
  top: 0;
  left: 0;
}
video {
  top: 70px;
  left: 0;
  min-height: 100%;
  min-width: 100%;
}
.header-text {
  position: absolute;
  width: 100%;
  min-height: 100%;
  z-index: 1000;
  background-color: rgba(0, 0, 0, 0.4);
}
.header-text h1 {
  text-align: center;
  font-size: 65px;
  text-transform: uppercase;
  font-weight: 300;
  color: #fff;
  padding-top: 15%;
  margin-bottom: 10px;
}
.header-text p {
  text-align: center;
  font-size: 20px;
  letter-spacing: 3px;
  color: #fff;
}
#scroll {
  cursor: pointer;
  display: block;
  position: absolute;
  bottom: 50px;
  left: 50%;
  z-index: 1000;
}
.round {
  height: 21px;
  width: 14px;
  border-radius: 10px;
  transform: none;
  border: 2px solid #fff;
  top: 170px;
}
.wheel {
  animation-delay: 0s;
  animation-duration: 1s;
  animation-iteration-count: infinite;
  animation-name: scrolling;
  animation-play-state: running;
  animation-timing-function: linear;
  background: #fff none repeat scroll 0 0;
  border-radius: 10px;
  height: 3px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  top: 4px;
  width: 2px;
}
.scrolling span {
    display: block;
    width: 5px;
    height: 5px;
    -ms-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -webkit-transform: rotate(45deg);
    transform: rotate(45deg);
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    margin: 3px 0 3px 5px;
}
.arrow {
    margin-top: 6px;
}
header {
  height: 100vh;
  overflow: hidden;
}

Nav dissapear and scrollable video

1 个答案:

答案 0 :(得分:0)

由于视频为position: absolute;,因此不在页面流中。您需要在header元素中添加一个高度才能使其生效。

header {
    height: 100vh;
    overflow: hidden;
}

我希望这个经过修改的CSS适合你。

/* Nav */
.navbar {
  padding: 1.2rem;
}
/* Video */
.bg-wrap {
  position: absolute;
  z-index: -1000;
  width: 100%;
  height: 100%;
  overflow: hidden;
  top: 0;
  left: 0;
}
video {
  position: relative;
  top: 70px;
  left: 0;
  min-width: 100%;
  background: black;
}
.header-text {
  position: absolute;
  top: 0;
  width: 100%;
  min-height: 100%;
  z-index: 1000;
  background-color: rgba(0, 0, 0, 0.4);
}
.header-text h1 {
  text-align: center;
  font-size: 65px;
  text-transform: uppercase;
  font-weight: 300;
  color: #fff;
  padding-top: 15%;
  margin-bottom: 10px;
}
.header-text p {
  text-align: center;
  font-size: 20px;
  letter-spacing: 3px;
  color: #fff;
}
#scroll {
  cursor: pointer;
  display: block;
  position: absolute;
  bottom: 50px;
  left: 50%;
  z-index: 1000;
}
.round {
  height: 21px;
  width: 14px;
  border-radius: 10px;
  transform: none;
  border: 2px solid #fff;
  top: 170px;
}
.wheel {
  animation-delay: 0s;
  animation-duration: 1s;
  animation-iteration-count: infinite;
  animation-name: scrolling;
  animation-play-state: running;
  animation-timing-function: linear;
  background: #fff none repeat scroll 0 0;
  border-radius: 10px;
  height: 3px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  top: 4px;
  width: 2px;
}
.scrolling span {
    display: block;
    width: 5px;
    height: 5px;
    -ms-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -webkit-transform: rotate(45deg);
    transform: rotate(45deg);
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    margin: 3px 0 3px 5px;
}
.arrow {
    margin-top: 6px;
}
header {
  height: 100vh;
  overflow: hidden;
}

.container {
  height: 100%;
  width: 100%;
}
<header>
<div class="container">
  <div class="bg-wrap">

      <video poster="poster.png" autoplay="true" loop muted>
      <source src="img/video.mp4" type="video/mp4">
      <source src="img/video.webm" type="video/webm">
    </video>

    <div class="header-text">
      <h1>Elektro Sikora</h1>
      <p>Informační portál Elektro Sikora Český Těšín</p>
    </div>

    <div id="scroll">
      <div class="round">
        <div class="wheel"></div>
      </div>
      <div class="scrolling">
        <span class="arrow"></span>
      </div>
    </div>
  </div>
  </div>
</header>

  <section id="content-space">
    <div class="container">
      <div class="row">
        <div class="col-lg-12 text-center">
          <p>
            Kompletní nabídka produktů, které nabízíme. Najdete zde od elektroniky až po zdravou výživu.
          </p>
        </div>
      </div>
    </div>
  </section>