I want to make a personal website but couldn't fit the video in my page. Unless I put max-height:100% i can still scroll horizontally. Or I disable absolute position, but then header wasn't able to show on the top of video. I used
overflow-x: hidden
but it didn't work. What is the best way to put video as background and still be able to put text on the top of it?
Thank you very much!!
video {
position: absolute;
z-index: -99;
/*min-width: 100%;
min-height: 100%;*/
width: 100%;
height: 100%;
background: url(../img/header-bg.jpg) no-repeat 0 0;
background-attachment: scroll;
background-position: center center;
background-repeat: none;
background-size: 100% auto;
-o-background-size: cover;
-webkit-background-size: cover;
-moz-background-size: cover;
}
header {
text-align: center;
color: #fff;
height: 100vh;
/*background-attachment: scroll;
background-image: url(../img/header-bg.jpg);
background-position: center center;
background-repeat: none;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;*/
}
<!-- Background Video -->
<video autoplay loop poster="data:image/gif,AAAA">
<source src="./ocean.mp4" type="video/mp4">
<source src="./ocean.ogv" type="video/ogv">
<source src="./ocean.webm" type="video/webm">
</video>
<!-- Header -->
<header>
<div class="container">
<div class="intro-text">
<div class="intro-lead-in">Welcome To Our Studio!</div>
<div class="intro-heading">IT'S NICE TO MEET YOU</div>
<a href="#services" class="page-scroll btn btn-xl">TELL ME MORE</a>
</div>
</div>
</header>