html - div/jumbotron 中背景视频的位置不正确

标签 html css twitter-bootstrap

我有一个在 div 背景中播放的视频,但是视频没有显示在文本后面,而是作为标题/注册表单上方的单独部分显示。

实例:http://185.123.96.102/~kidsdrum/moneynest.co.uk/

我希望在视频顶部显示文本和电子邮件注册表单。

请注意,我使用 Bootstrap 进行响应式设计(视频隐藏在平板电脑/手机上)。

我想要在我的超大屏幕中播放一段视频。

浏览器窗口的全宽和高度为 100%(滚动时下方有更多内容),这适用于图像,但现在出现问题。

CSS

.jumbotron {
color: white;
position:relative;
overflow:hidden;
height:500px
}


    html,body {height:100%;}
.special,.special .jumbotron 
{height:100%;
width: 100%;
    margin: 0px;
    padding: 0px;
border-radius: 0px;
}

.fullscreen-bg {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  overflow: hidden;
  z-index: -100;
}

.fullscreen-bg__video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

@media (min-aspect-ratio: 16/9) {
  .fullscreen-bg__video {
    height: 300%;
    top: -100%;
  }
}

@media (max-aspect-ratio: 16/9) {
  .fullscreen-bg__video {
    width: 300%;
    left: -100%;
  }
}

@media (max-width: 767px) {
  .fullscreen-bg {
    background: url('../img/videoframe.jpg') center center / cover no-repeat;
  }

  .fullscreen-bg__video {
    display: none;
  }
}

HTML

<div class="jumbotron">
<div class="fullscreen-bg"></div>
<div class="container special">
<video loop muted autoplay poster="img/videoframe.jpg" class="fullscreen-bg__video">

        <source src="http://185.123.96.102/~kidsdrum/moneynest.co.uk/vid/people-with-no-money-worries.mp4" type="video/mp4">

    </video>
</div></div>


  <div class="container text-center">
    <div class="h1extrapadding hidden-xs hidden-sm"></div>  <h1 class="boldme">Aged 20-30 & frustrated with money?</h1> 
    <div class="greenpromobox">
    <div class="h2extrapadding hidden-xs hidden-sm"></div>  <h2 class="boldme">Take our free <b class="jumpstarttext">Jumpstart Your Finances</b> class to<br /> quickly gain control over your finances</h2>


            <!-- Begin MailChimp Signup Form -->
<div id="mc_embed_signup">
<form action="//moneynest.us11.list-manage.com/subscribe/post?u=9ccf2d2219536b32eaae3c3d1&amp;id=299de51b4e" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
    <div id="mc_embed_signup_scroll">


                   <img src="http://185.123.96.102/~kidsdrum/moneynest.co.uk/img/hand-drawn-arrow.png" id="handarrow" class="hidden-xs hidden-sm" alt="arrow"><input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="Enter your email address" required autofocus>
    <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
    <div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_9ccf2d2219536b32eaae3c3d1_299de51b4e" tabindex="-1" value=""></div>
    <div class="clear"><input type="submit" value="Start Class Now" name="subscribe" id="mc-embedded-subscribe" class="text-uppercase btn btn-primary btn-lg"></div>
    </div>
</form>
</div>

<!--End mc_embed_signup-->

</div>
</div>

 </div>
</div>
  </div>

最佳答案

将以下样式添加到您的 .jumbotron

margin-bottom: -500px;
z-index: -1;

应该可以帮助您完成此静态设置。您还可以使用此元素的边距值来正确布局它们。

关于html - div/jumbotron 中背景视频的位置不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35481620/

相关文章:

javascript - 无法通过保持输入文本宽度相同来增加 ng2-autocomplete 的宽度

javascript - 如何将 Angular View 嵌入到其他应用程序中?

css - 改变div的背景颜色

c# - 在 Windows Phone 8 应用程序中动态注入(inject) javascript

html - 需要一个选项来回到以前的网页设计

javascript - 关闭 Bootstrap Dialog 后滚动条消失

css - 当你向上滚动时,让一个固定的 div 被内容 div 覆盖

css - (CSS) 高度拉伸(stretch)与顶部 : 0 and bottom: 0 with Pseudo-Element?

c# - 在 bundleconfig 中添加 Bootstrap 在 asp.net mvc 中不起作用

html - 使用导航栏中的 Role 属性覆盖默认 css