背景视频在div / jumbotron中的位置不正确 [英] Incorrect placement of background video in div/jumbotron
问题描述
我有一个视频在div背景中播放,而不是显示在标题/注册表单上方的一个单独部分。
直播示例: http://185.123.96.102/~kidsdrum/moneynest.co.uk /
我想在文字和电子邮件注册表单上显示影片。 b
$ b
请注意,我使用Bootstrap作为自适应设计(视频隐藏在平板电脑/手机上)。
使用全宽,浏览器窗口的高度为100%(滚动时下面有更多内容),这适用于
<$> c $ c> .jumbotron {
color:white;
position:relative;
overflow:hidden;
height:500px
}
html,body {height:100%;}
.special,.special .jumbotron
{高度: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.jpgclass =fullscreen-bg__video>
< source src =http://185.123.96.102/~kidsdrum/moneynest.co.uk/vid/people-with-no-money-worries.mp4type =video / mp4>
< / video>
< / div>< / div>
< div class =container text-center>
< div class =h1extrapadding hidden-xs hidden-sm>< / div> < h1 class =boldme>年龄20-30&沮丧的钱?< / h1>
< div class =greenpromobox>
< div class =h2extrapadding hidden-xs hidden-sm>< / div> < h2 class =boldme>带上我们的免费< b class =jumpstarttext> Jumpstart您的财务< / b>类为< br />快速获得对您财务的控制< / h2>
<! - 开始MailChimp注册表单 - >
< div id =mc_embed_signup>
< form action =// moneynest.us11.list-manage.com/subscribe/post?u=9ccf2d2219536b32eaae3c3d1&id=299de51b4emethod =postid =mc-embedded-subscribe- formname =mc-embedded-subscribe-formclass =validatetarget =_ blanknovalidate>
< div id =mc_embed_signup_scroll>
< img src =http://185.123.96.102/~kidsdrum/moneynest.co.uk/img/hand-drawn-arrow.pngid =handarrow class =hidden-xs hidden-smalt =arrow>< input type =emailvalue =name =EMAILclass =emailid =mce-EMAILplaceholder =Enter您的电子邮件地址required autofocus>
<! - 真实的人不应该填补这一点,期待好东西 - 不要删除这个或风险形式僵尸网络注册 - >
< div style =position:absolute; left:-5000px; aria-hidden =true>< input type =textname =b_9ccf2d2219536b32eaae3c3d1_299de51b4etabindex = - 1value =>< / div>
< div class =clear>< input type =submitvalue =Start Class Nowname =subscribeid =mc-embedded-subscribeclass =text-uppercase btn btn-primary btn-lg>< / div>
< / div>
< / form>
< / div>
<! - 结束mc_embed_signup - >
< / div>
< / div>
< / div>
< / div>
< / div>
在div中添加一个类形式),我已添加 .emailBox
例如并在
.emailBox {
left:50%;
margin-left:-585px;
position:absolute;
top:0;
}
希望这可以解决您的问题。
I have a video playing in the background of a div, however rather than showing behind the text the video is showing as a seperate section above the headline/signup form.
Live example: http://185.123.96.102/~kidsdrum/moneynest.co.uk/
I'd like the text and email signup form to show on top of the video.
Please note I'm using Bootstrap for a responsive design (video hidden on tablets/mobiles).
I'd like a video to play in the background of my jumbotron.
With full width and a height of 100% of the browser window (more content below when scrolled), this worked for an image but is having issues now.
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&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>
add a class in your div (text and email signup form), I have added .emailBox
for example and add the following style in that
.emailBox {
left: 50%;
margin-left: -585px;
position: absolute;
top: 0;
}
hope this will solve your issue.
这篇关于背景视频在div / jumbotron中的位置不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!