Video background not resizing to full height of window - html

I am having two problems with the implementation of my video background:
1) My video background won't take the full height of the screen when it is resized. What would be the best way of fixing it.
2) I cannot click on the "Return to Website" button.
How can I fix it?
HTML
<div>
<div id="outer">
<div id="home-top-video">
<video autoplay loop muted width="100%">
<source src="http://view.vzaar.com/2710053.mp4" type="video/mp4" /> Your browser does not support the video tag. We suggest you upgrade your browser.
</video>
<div id="top-text">
<h3 class="wow fadeIn" data-wow-delay="1s" data-wow-duration="2s" style="font-size: 5em">
Lifestyle
</h3>
<div class="gold-line wow fadeIn" data-wow-delay="1.25s" data-wow-duration="2s" style="margin-top: 25px; margin-bottom: 25px;"></div>
<h5 class="wow fadeIn" data-wow-delay="1.5s" data-wow-duration="2s" style="font-family: 'Josefin Slab', sans-serif; letter-spacing: 4px;">COMING SOON</h5>
</div>
<div id="bottom-text">
<div class="row" style="margin-bottom: 2em; font-family: 'Josefin Slab'">
<div class="col-md-4 wow fadeIn" data-wow-delay="2s" data-wow-duration="2s">"The way of the world is meeting people through other people."</div>
<div class="col-md-4 wow fadeIn" data-wow-delay="2.5s" data-wow-duration="2s">"The way we think, we become"</div>
<div class="col-md-4 wow fadeIn" data-wow-delay="3s" data-wow-duration="2s">"Personal development is a journey, not a destination. Enjoy it, nonetheless."</div>
</div>
<div style="width: 100%;">
<a class="contact-button" href="/about" target="_self" style="z-index: 2">RETURN TO WEBSITE</a>
</div>
</div>
</div>
</div>
</div>
CSS
/* Latest compiled and minified CSS included as External Resource*/
/* Optional theme */
#import url('//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css');
#outer {
width: 100%;
display: block;
text-align: center;
position: relative;
overflow: hidden;
min-height: 100vh;
}
#outer #home-top-video:before {
content: "";
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
z-index: 1;
background: linear-gradient(to right, rgba(71, 75, 84, 0.7), rgba(71, 75, 84, 0.9));
}
#home-top-video {
left: 0%;
top: 0%;
height: 100vh;
width: 100%;
max-width: 1000%;
overflow: hidden;
position: absolute;
z-index: -1;
}
#top-text {
position: absolute;
left: 50%;
top: 8em;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
color: #fff;
z-index: 1;
font-family: 'Early Bird', sans-serif;
width: 300px;
}
#bottom-text {
position: absolute;
left: 50%;
bottom: -12px;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
color: #fff;
z-index: 1;
width: 100%;
}

To make the video fit the entire screen, including a resized screen, you can add the following styles to the video element itself:
<video id="video" autoplay loop muted width="100%">
#video{
height: 100%;
width: 100%;
object-fit: cover;
}
Your link is not clickable because it's nested inside the home-top-video element, who's z-index is set to -1. Your page's styles won't change when you simply delete it.
#home-top-video {
left: 0%;
top: 0%;
height: 100vh;
width: 100%;
max-width: 1000%;
overflow: hidden;
position: absolute; // delete this
z-index: -1; // and delete this
}
Now while this solves both problems, another problem is that the bottom text get mixed up with the top text when you resize the screen vertically. You could solve this with the css grid or flex. But there are so many divs and inline styles that I'm not sure where to start. Except for the two lines mentioned above, there's more css you that you can remove without noticing any changes in style btw.
I hope this helps you a bit further.

Solution_1:
(i). If you would your site video background take the full height of the screen although it is resized or whatever about anything.
just write the following CSS property
#home-top-video video{
display: block; // If cross-browsering performance
width: 100%; // Not needed for your purpose because it's gets from HTML attribute
height: 100%;
object-fit: cover;
}
(ii). Your comment through of Luis Gar
I don't mind if the video loses part of its width as long as its
centered
Then add one more property
object-position: 50% 50%;
Solution_2: For click on the "Return to Website" button.
In your css file, you wrote on the following code
#home-top-video {
left: 0%;
top: 0%;
height: 100vh;
width: 100%;
max-width: 1000%;
overflow: hidden;
position: absolute; // Remove This
z-index: -1; // Remove This Also
}
For this cause id="home-top-video"(child area) is going down below id="outer"(parent area) so that you can't access the child area content.
So simply remove that on the following code
check This on the following link

Related

Video banner in html (bootstrap page) incorrectly laid out

I am attempting to adapt code from this site: Video Header snippet
This places a video header and it overrides my entire page and content with itself (the video header).
I would like to resize the header so that it has a width of 100% (across the whole page) and a height of x (decided by me) e.g. 200.
I've tried various things to change both the overlay size and the video but nothing has worked.
<h1>My Website</h1>
<p>Website text here</p>
<header>
<div class="overlay"></div>
<video playsinline="playsinline" autoplay="autoplay" muted="muted" loop="loop">
<source src="https://storage.googleapis.com/coverr-main/mp4/Mt_Baker.mp4" type="video/mp4">
</video>
<div class="container h-100">
<div class="d-flex h-100 text-center align-items-center">
<div class="w-100 text-white">
<h1 class="display-3">Video Header</h1>
<p class="lead mb-0">With HTML5 Video and Bootstrap 4</p>
</div>
</div>
</div>
</header>
The whole of the css used is below. Note, this is used in the same style sheet as bootstrap css has been implemented.
header {
position: relative;
background-color: black;
height: 15vh;
min-height: 15rem;
width: 100%;
overflow: hidden;
}
header video {
position: absolute;
top: 50%;
left: 50%;
min-width: 100%;
min-height: 40%;
width: auto;
height: 40%;
z-index: 0;
-ms-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
header .container {
position: relative;
z-index: 2;
}
header .overlay {
position: absolute;
top: 0;
left: 0;
height: 40%;
width: 100%;
background-color: black;
opacity: 0.5;
z-index: 1;
}
#media (pointer: coarse) and (hover: none) {
header {
background: url('https://source.unsplash.com/XT5OInaElMw/1600x900') black no-repeat center center scroll;
}
header video {
display: none;
}
}
As you can see I have adapted the code from its original (see link above). For instance I have changed this value from 100% to 40%. It works in that it changes the overlay size.
header .overlay {
position: absolute;
top: 0;
left: 0;
height: 40%;
width: 100%;
What I cannot figure out however is how to get the video also part of the overlay and sized correctly AND for the rest of my existing content not to be hidden from view/overwritten.
For some reason, once I add this content, I cannot scroll down through my site.
If I understand your question :) ,
I think setting the height and min-height to 200px for the header fix the issue like :
header {
position: relative;
background-color: black;
height: 200px;
min-height: 200px;
width: 100%;
overflow: hidden;
}
see below snippet :
header {
position: relative;
background-color: black;
height: 200px;
min-height: 200px;
width: 100%;
overflow: hidden;
}
header video {
position: absolute;
top: 50%;
left: 50%;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: 0;
-ms-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
header .container {
position: relative;
z-index: 2;
}
header .overlay {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: black;
opacity: 0.5;
z-index: 1;
}
#media (pointer: coarse) and (hover: none) {
header {
background: url('https://source.unsplash.com/XT5OInaElMw/1600x900') black no-repeat center center scroll;
}
header video {
display: none;
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.slim.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js"></script>
<header>
<div class="overlay"></div>
<video playsinline="playsinline" autoplay="autoplay" muted="muted" loop="loop">
<source src="https://storage.googleapis.com/coverr-main/mp4/Mt_Baker.mp4" type="video/mp4">
</video>
<div class="container h-100">
<div class="d-flex h-100 text-center align-items-center">
<div class="w-100 text-white">
<h1 class="display-3">Video Header</h1>
<p class="lead mb-0">With HTML5 Video and Bootstrap 4</p>
</div>
</div>
</div>
</header>
<section class="my-5">
<div class="container">
<div class="row">
<div class="col-md-8 mx-auto">
<p>The HTML5 video element uses an mp4 video as a source. Change the source video to add in your own background! The header text is vertically centered using flex utilities that are build into Bootstrap 4.</p>
<p>The overlay color can be changed by changing the <code>background-color</code> of the <code>.overlay</code> class in the CSS.</p>
<p>Set the mobile fallback image in the CSS by changing the background image of the header element within the media query at the bottom of the CSS snippet.</p>
<p class="mb-0">
Created by Start Bootstrap
</p>
</div>
</div>
</div>
</section>
Try deleting all the z-index you have in your CSS and then add z-index: -1; on the media query inside the header, like this:
#media (pointer: coarse) and (hover: none) {
header {
background: url('https://source.unsplash.com/XT5OInaElMw/1600x900') black no-repeat center center scroll;
z-index: -1;
}
header video {
display: none;
}
}

Z-Indexed container isn't clickable

I've implemented a bootstrap snippet for video header on my website. It consists of 3 layers:
1. Video (z-index: 0)
2. Overlay of the video (z-index: 1)
3. Text and button (z-index:3)
The arrangement of layers work perfectly, with video being in the background, overlay on top of it, and then text and button on all of that. However, the text and button on front layer isn't clickable, so the button is not in function.
header {
position: relative;
background-color: transparent;
height: 75vh;
min-height: 25rem;
width: 100%;
overflow: hidden;
}
header video {
position: absolute;
z-index: 0;
top: 50%;
left: 50%;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
-ms-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
header .container {
position: relative;
z-index: 2;
}
header .overlay {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: #37250F;
opacity: 0.5;
z-index: 1;
}
#media (pointer: coarse) and (hover: none) {
header {
background: url('https://source.unsplash.com/XT5OInaElMw/1600x900') black no-repeat center center scroll;
}
header video {
display: none;
}
}
<header>
<div class="overlay"></div>
<video playsinline="playsinline" autoplay="autoplay" muted="muted" loop="loop">
<source src="https://storage.googleapis.com/coverr-main/mp4/Mt_Baker.mp4" type="video/mp4">
</video>
<div class="container h-100">
<div class="d-flex h-100 text-center align-items-center">
<div class="w-100 text-white">
<h1 style="font-size:250%; text-align: center; padding-top:170px;">Preplati se na dostavu svježeg voća</h1>
<form action="http://www.opgnjavro.hr/dostava-voca/">
<button class="snip1562">Saznaj više</button>
</form>
</div>
</div>
</div>
</header>
It's been fixed. I was mixing Elementor with WordPress theme and the navigation of WP theme blocked the Elementor HTML code.
Thanks everyone!

How to center an animated image and unanimated text on a webpage, regardless of the device type, in HTML and CSS?

I tried putting the animated image into a table, but the animation doesn't work in that case.
I can only use HTML and CSS to make this work.
I'm wanting to center the green, spinning circle on the page both vertically and horizontally, have the logo sit without spinning inside of the circle, and have text that changes every 5 seconds right beneath it, centered horizontally and not too far vertically from the edge of the circle.
Right now, with the following code, the mobile version looks like:
(The red circle circles the logo, which is also appearing smaller than I want it to be)
The desktop view currently looks like:
As you can see here, the logo is still slightly off center vertically and the circle is really close to the top of the screen, rather than center.
So far I have in HTML:
<div id="animatedLogo">
<div id="loadingCircle">
<img id="loadingLogo" src="../Content/images/HCSS_GooglePresentation_Spinner_Green.PNG" class="circle" />
</div>
<div id="wordLogo">
<img id="HCSSLogo" src="../Content/images/hcss logo2.jpg" class="logo" />
</div>
<div id="myPhrase" class="phrase"></div>
</div>
<div class="main-container container-fluid">
<div class="row">
<div class="span6">
<form method="post" action="{responseUri}">
{responseFields}
</form>
</div>
</div>
</div>
<link href="../Content/please-wait.css" rel="stylesheet" />
<script src="/Scripts/logoAnimation.js"></script>
<script src="/Scripts/formPostResponse.js"></script>
And in CSS I have:
#animatedLogo {
text-align: center;
}
#loadingLogo {
animation: rotation 2.5s infinite linear;
min-height: 100%;
min-width: 35%;
padding: 1% 0;
}
#keyframes rotation {
from {
transform: rotate(0deg);
}
to {
transform: rotate(359deg);
}
}
#loadingCircle {
min-height: 77%;
min-width: 35%;
}
#wordLogo {
width: 100%;
height: 67%;
position: absolute;
top: 0;
left: 0;
/*padding: 5% 0;*/
margin-top: 5%;
}
.circle {
}
.logo {
width: 10%;
padding: 11% 0;
}
.phrase {
font-family: "Proxima Nova", sans-serif;
font-size: 24px;
font-style: oblique;
position: absolute;
/* top: 625px; */
margin-left: 50%;
/* text-align: center; */
transform: translateX(-50%);
}
(Added 3:58 pm on 6/20) In addition, I need to make sure the circle doesn't alter its shape and become an oval like it did here when I changed my solution to fit a suggested answer:
Added at 8:19 a.m. on 6/21/18The circle no longer becomes an oval! However, nothing is centered now.
Update as of 9:24 am
We're getting closer!!
1) I realize that I probably should pick a certain ratio of the size of the logo to the size of the spinner to use so that the logo doesn't get so small on mobile versions. I'm searching the web for ideas, but if you know of one particularly fitting for this project, let me know!
2) Now we need to get the phrases under the spinner, rather than out to the side.
Update 3
Bring the phrase out of the centered class like this:
<div id="centered">
<div id="animatedLogo">
<div id="loadingCircle">
<img id="loadingLogo" src="../Content/images/HCSS_GooglePresentation_Spinner_Green.PNG" class="circle" />
</div>
</div>
<div id="wordLogo">
<img id="HCSSLogo" src="../Content/images/hcss logo2.jpg" class="logo" />
</div>
</div>
<div id="myPhrase" class="phrase">phrase phrase phrase phrasephrase</div>
Then in the css change this:
.phrase {
font-family: "Proxima Nova", sans-serif;
font-size: 4vmin;
font-style: oblique;
position: absolute;
bottom: 20px;
width: 100%;
left: 50%;
height: 10%;
text-align: center;
transform: translateX(-50%);
}
To change things on smaller screens use media query:
#media only screen and (max-width: 767px) {
.someClass {
color: red;
}
}
Update 2
Okay, I tested things out and this should work:
html:
<div id="centered">
<div id="animatedLogo">
<div id="loadingCircle">
<img id="loadingLogo" src="../Content/images/HCSS_GooglePresentation_Spinner_Green.PNG" class="circle" />
</div>
</div>
<div id="wordLogo">
<img id="HCSSLogo" src="../Content/images/hcss logo2.jpg" class="logo" />
</div>
<div id="myPhrase" class="phrase"></div>
</div>
css:
#centered {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
#wordLogo {
position: absolute;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
/* height: 67%; */
/* position: absolute;
top: 0;
left: 0; */
/*padding: 5% 0;*/
/* margin-top: 5%; */
}
update
Try this out if flexbox is not working:
#loadingCircle, #wordLogo {
position: relative;
}
#loadingCircle img, #wordLogo img {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
Try using flexbox:
#loadingCircle, #wordLogo {
display: flex;
justify-content: center;
align-items: center;
}
Let me know if it works or not.

Image not repeating properly

I'm trying to make a small image repeat as an overlay across the entire background video, but it just isn't working. I got it to this point and I've tried every multitude things I can think of. Any suggestions?
Code:
.overlay {
position: relative;
z-index: 2;
overflow: hidden;
opacity: 0.7;
background: #000 url(../media/overlay.png) repeat;
}
.content {
position: relative;
top: 30%;
z-index: 3;
margin: 0 auto;
max-width: 720px;
text-align: center;
}
.video {
position: fixed;
top: 50%;
left: 50%;
z-index: 1;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
<div>
<div class="overlay">
<img src="/media/overlay.png" />
</div>
<div class="content">
<h1 class="content__heading"><img src="/media/logo.png" /></h1>
<p class="content__teaser"> tba. </p>
tba.
</div>
<video id="my-video" class="video" muted loop>
<source src="media/bg.mp4" type="video/mp4">
</video></div>
Your overlay isn't big enough to show the repeating background.
try making the overlay full-page:
.overlay {
width: 100%;
height: 100%;
}
You don't need to include the <img> in the HTML, since you already display the image using a CSS background.
See a working example here (Note: I had to make .overlay position: absolute so that the overlay covers the whole height of the page)

CSS width not centering the image

I am using wordpress as my CMS, and have used a theme of my choice. The theme shows a slider (carousel) on the home page, but takes up too much space. I tried to edit the width and height to be 80%, but the UI gets screwed. The slider does not center, or the frame with the left right arrows come closer. The image gets smashed. I need to get the css right for this.
I tried the following
modified width and height to 80%
reduced the px values, messed it up further
Below I have relevant css and html portions of the code.
<div id="slides">
<div class="slides_container slide" style="overflow: hidden; position: relative; display: block;">
<div class="slides_control" style="position: relative; width: 2736px; height: 480px; left: -912px;"><div style="position: absolute; top: 0px; left: 912px; z-index: 5;">
<img src="http://localhost/taxeeta/wp-content/uploads/2013/01/116.png?1358343444279" alt="">
</div>
<div style="position: absolute; top: 0px; left: 912px; z-index: 0; display: none;">
<img src="http://localhost/taxeeta/wp-content/uploads/2013/01/215.png" alt="">
</div>
</div>
</div>
CSS:
#slides {
position: absolute;
top: 15px;
left: 0px;
z-index: 100;
width: 897px;
margin-left: 14px;
}
.slides_container {
width: 912px;
margin: 0;
padding: 0;
}
.slides_control {
position: absolute;
top: 15px;
left: 0px;
z-index: 100;
width: 897px;
margin-left: 14px;
}
Are you sure that there is jo javascript code modifying the element-css?
Did you changes the width of slides and slides_control as the same?
(sorry iam not able to write comments...)