I have a button that is sitting ontop of both a full screen video and an opaque overlay.
<section id="contact" class="threemonth-section">
<div class="container">
<video id="video_background" preload="auto" autoplay="true" muted="true" loop="loop" volume="0" >
<source src="video2.webm" type="video/webm">
<source src="video2.m4v" type="video/mp4"> Video not supported
</video>
<div id="overlay2"></div>
<div id="welcomingText">
<h2 class="welcoming">Welcome</h2>
<h3 class="to">to</h3>
<h1 class="mySite">my site</h1>
</div>
<button type="button" class="button"></button>
</div>
</section>
and here is the CSS for each part of this.
.threemonth-section {
height: 105%;
width: 100%;
position:relative;
display:table;
padding-top: 200px;
z-index:-5;
text-align: center;
background: url(../img/3monthNew.png) no-repeat center center scroll;
background-size:cover;
}
#video_background { position: absolute; z-index:-4; bottom: 0px; right: 0px; min-width: 100%; min-height: 100%; width: auto; height: 105%; overflow: hidden; }
#overlay2{
background-color:#000;
height:100%;
width:100%;
opacity:0.5;
z-index:-2;
position: absolute;
bottom: 0px; right: 0px; min-width: 100%; min-height: 100%; width: auto; height: auto; overflow: hidden;
}
#welcomingText{
margin-top:50px;
height:100%;
width:100%;
z-index:200;
color:#fff;
padding-top:15%;
z-index:-1;
margin-bottom:auto;
position: absolute;
bottom: 0px; right: 0px; min-width: 100%; min-height: 100%; width: auto; height: auto; overflow: hidden;
}
.button{
background: transparent url('button.png') no-repeat top;
height: 50px;
width:50px;
background-size:100%;
position:absolute;
z-index:2;
background-repeat:no-repeat;
margin-left: 267px;
}
I can't figure out why my button is un-clickable. I know its got no actions but It's being overlayed by something but I can't figure out why. Both positioning in my HTML and the z-index lead me to believe it should be on top?
It's probably pretty obvious but I've been staring at this for hours. Any ideas?
Related
I have to set a Vimeo as background for a div which is containing CTA box.
I found some example and made it possible to have the video background fullscreen and responsive as I needed.
But I found that the CTA box inside and the button are not clickable because of the "z-index" used to get the video back in the div.
play with z-index
moving element back and forth
.vimeo-wrapper {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
display:flex;
pointer-events: none;
overflow: hidden;
}
.vimeo-wrapper iframe {
width: 100vw;
height: 56.25vw; /* Given a 16:9 aspect ratio, 9/16*100 = 56.25 */
min-height: 100vh;
min-width: 177.77vh; /* Given a 16:9 aspect ratio, 16/9*100 = 177.77 */
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}.content{
display:flex;
align-items:center;
justify-content:center;
z-index:1;
flex-wrap:wrap;
}.content,h2{
width:100%;
text-align:center;
color:white;
}
.CTA-wrapper{
border:2px solid white;
width:30%;
padding-bottom:2%;
}
div button:hover {
color: yellow;
}
<div class="vimeo-wrapper">
<iframe src="https://player.vimeo.com/video/342964528? background=1&autoplay=1&loop=1&byline=0&title=0" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<div class="content">
<div class="CTA-wrapper">
<h2>CTA Header</h2>
<button class="btn-success">Click Me</button>
</div>
</div>
</div>
expected: clickable inside elements, fullscreen and responsive background video
result: not the clickable inside element
.CTA-wrapper{
position: relative;
z-index: 9999;
}
I think it will work
css
.vimeo-wrapper {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
display:flex;
pointer-events: none;
overflow: hidden;
}
.content,h2{
width:100%;
text-align:center;
color:white;
}
.CTA-wrapper{
border:2px solid white;
padding-bottom:2%;
}
.vimeo-wrapper-box {
width: 100%;
}
div button:hover {
color: yellow;
}
.iframe_wrapper {
position: relative;
padding-bottom: 56.25%;
}
.vimeo-wrapper iframe {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0px;
width: 100%;
height: 100%;
}
.vimeo-wrapper .content {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
text-align: center;
}
HTML
<div class="vimeo-wrapper">
<div class="vimeo-wrapper-box">
<h1>dfghfh</h1>
<div class="iframe_wrapper">
<iframe src="https://player.vimeo.com/video/342964528?background=1&autoplay=1&loop=1&byline=0&title=0" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<div class="content">
<div class="CTA-wrapper">
<h2>CTA Header</h2>
<button class="btn-success">Click Me</button>
</div>
</div>
</div>
</div>
</div>
I am trying to make a background video with the fixed height of 700px without affecting the aspect ratio. video can crop. My issue is that the full height of the video is showing even I have provided a height of 700 px. Here is the code:
<div class="video-container">
<div class="video-overlay-text">
<h1>Some heading</h1>
<p>Sentence</p>
</div>
<video autoplay loop muted id="video-bg">
<source src="homepage-video-mp4_1.mp4" type="video/mp4" />
</video>
</div>
here is the CSS:
#video-bg {
position: relative;
width: auto;
min-width: 100%;
height: auto;
background: transparent url(video-bg.jpg) no-repeat;
background-size: cover;
}
video {
display: block;
position: absolute;
}
.video-container {
width: 100%;
height: 600px;
overflow: hidden;
position: relative;
top: 0;
right: 0;
z-index: 0;
}
.video-overlay-text {
position: absolute;
z-index: 5;
overflow: auto;
bottom: 20%;
left: 4%;
max-width: 700px;
margin: auto;
display: block;
}
.video-overlay-text h1 {
color: #ffffff;
font-size:34px;
line-height: 36px;
}
.video-overlay-text p {
color: #ffffff;
}
I have tried everything. Sometimes the mobile view gets cut and the text moves way up.
I have added max-height which will be helpful for all screen sizes. Also added a demo text to show the limit of the video. Hope this helps.
#video-bg {
position: relative;
width: auto;
min-width: 100%;
background: transparent url(video-bg.jpg) no-repeat;
background-size: cover;
}
video {
display: block;
position: absolute;
}
.video-container {
width: 100%;
max-height: 600px;
overflow: hidden;
position: relative;
top: 0;
right: 0;
z-index: 0;
}
.video-overlay-text {
position: absolute;
z-index: 5;
overflow: auto;
bottom: 20%;
left: 4%;
max-width: 700px;
margin: auto;
display: block;
}
.video-overlay-text h1 {
color: #ffffff;
font-size: 34px;
line-height: 36px;
}
.video-overlay-text p {
color: #ffffff;
}
<div class="video-container">
<div class="video-overlay-text">
<h1>Some heading</h1>
<p>Sentence</p>
</div>
<video autoplay loop muted id="video-bg">
<source src="//ak3.picdn.net/shutterstock/videos/2743133/preview/stock-footage-shanghai-china-circa-july-timelapse-video-of-shanghai-china-skyline-at-sunset-circa-july.mp4" type="video/mp4" />
</video>
</div>
<h2>Hello</h2>
I need to have some text centered within this video. I got rid of the container for the header, and the desired results are still in tact, so that works with me, but I've struggled to deal with centering this text!
<div class="video-container">
<video class="video" preload="true" autoplay = "autoplay" loop = "loop">
<source src="nyc.mp4" type="video/mp4"/>
</video>
<p class="center-block quote"> Test </p>
Styling:
.video-container {
position:absolute;
top: 0%;
left: 0%; /*centers the video */
height: 100%;
width: 100%;
overflow: hidden;
}
video {
margin-top:50px; /* gap b/w navbar and header */
position:absolute;
z-index: -1;
opacity: 0.78;
width: 100%;
margin: none;
padding: none;
}
Bootstrap has a built in helper class - .text-center
Try this: <div class="video-container text-center">
here a print screen
worked print screen
<!DOCTYPE html>
<html>
<body>
<style>
.center-block{text-align: center;}
.video-container {
position:absolute;
top: 0%;
left: 0%; /*centers the video */
height: 100%;
width: 100%;
overflow: hidden;
}
video {
margin-top:50px; /* gap b/w navbar and header */
position:absolute;
z-index: -1;
opacity: 0.78;
width: 100%;
margin: none;
padding: none;
}
</style>
<div class="video-container">
<video class="video" preload="true" autoplay = "autoplay" loop = "loop">
<source src="nyc.mp4" type="video/mp4"/>
</video>
<p class="center-block quote"> Test </p>
</div>
</body>
</html>
Use this
<p class="center-block quote" style="text-align:center;"> Test </p>
And also paste this one:
.video-container {
position:relative;
top: 0%;
left: 0%; /*centers the video */
height: 100%;
width: 100%;
overflow: hidden;
}
.video-container video{
position: fixed;
top: 100%;
left: 100%;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: -100;
transform: translate(-100%, -100%);
}
.video-container{
justify-content: centre;
width: 100%;
height: 100%;
text-align: centre;
}
Example Issue: http://jsfiddle.net/4y5rqoxr/
.outer {
min-width: 100%;
}
#bgvid {
position: relative;
min-width: 100%;
width: 100%;
z-index: -100;
background-size: cover;
}
.inner{
position: absolute;
top: 0;
left: 0;
width:33%;
height:100%; /*HOW TO MAKE THIS 100% OF THE PARENT DIV? NOT 100% VIEWPORT*/
background:#FF0004;
}
Hey guys, im trying to make a text box overlay a video Background and adopt the video divs height? any help ive poked around a bunch with no luck!
Zak
You need a height declaration and position:relative; on your parent element.
.outer {
height:100%;
position:relative;
}
See Snippet.
.outer {
min-width: 100%;
height:100%;
position:relative;
}
#bgvid {
position: relative;
min-width: 100%;
width: 100%;
z-index: -100;
background-size: cover;
}
.inner{
position: absolute;
top: 0;
left: 0;
width:33%;
height:100%; /*HOW TO MAKE THIS 100% OF THE PARENT DIV? NOT 100% VIEWPORT*/
background:#FF0004;
}
<div class="outer">
<video autoplay poster="http://placehold.it/1600x900" id="bgvid" loop>
<source src="" type="video/webm">
</video>
<div class="inner">
</div>
</div>
I want to create a responsive background video, but don't know how to change the alignment.
As far as I can see, the alignment currently is bottom right, but I want to change it to center center. (like background-position: center center)
Is there any way to achieve this?
Fiddle: http://jsfiddle.net/66dLhjxh/
HTML:
<video autoplay loop poster="http://demosthenes.info/assets/images/polina.jpg" id="bgvid">
<source src="http://demosthenes.info/assets/videos/polina.webm" type="video/webm">
<source src="http://demosthenes.info/assets/videos/polina.mp4" type="video/mp4">
</video>
CSS:
video {
position: fixed;
display:block;
right: 0;
bottom: 0;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: -100;
background-color:#fff;
background:url(../img/schrijven.jpg) no-repeat;
background-size: cover;
background-position: center center;
}
try this code DEMO
<div id="info">
Responsive Youtube embed......
</div>
<div class="holder">
<div class="video-container">
</div>
</div>
<button onclick="nextVideo()">Next Video</button>
</div>
.video-container {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 30px; /* size of chrome */
height: 0;
overflow: hidden;
}
.video-container iframe,
.video-container object,
.video-container #overlay,
.video-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
#overlay {
background:#000;
opacity:0.5;
/*background:rgba(255,255,255,0.8); or just this*/
z-index:50;
color:#fff;
}
with this is perfect
video {
position: fixed;
display:block;
right: 0;
bottom: 0;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: -100;
background-color:#fff;
background:url(../img/schrijven.jpg) no-repeat;
top: 0px;
left: 0px;
background-size: cover;
background-position: 50% 50%;
/*background-position: 30% 50%;*/
}
See it in action.