Immersive Video Background Taking up the Entire Screen with Content Hidden Below

Currently working on integrating a full screen video background with content positioned below the fold.

Successfully implemented the full screen video without any issues. However, struggling to figure out how to add content underneath the video while ensuring it stops at the fold:

TARGET:

HTML:

<div class="container-fluid">

<div id='videoBG' class="row">

<video autoplay loop muted poster="screenshot.jpg" id="background">
<source src="http://techslides.com/demos/sample-videos/small.mp4" type="video/mp4">
</video>

<p id='mainHeader'> Header Title </p>


</div>
</div>

<div class="container-fluid">
<div class='row'> 

<h1> Start of the second section below the video</h1>

</div>
</div>

CSS:

#background {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: -100;
    -webkit-transform: translateX(-50%) translateY(-50%);
    transform: translateX(-50%) translateY(-50%);
    background: url(polina.jpg) no-repeat;
    background-size: cover;
}

Answer №1

Have you considered utilizing the viewport size for your design? I found this quick test to be quite effective

<div style="background-color:blue;width:100vw;height:100vh">
</div>
<div>
    hey
 <ul>
  <li>ho</li>
  <li>ho</li>
  <li>ho</li>
  <li>ho</li>
  <li>ho</li>
  <li>ho</li>
 </ul>
</div>

Answer №2

To create more space, you could set a margin-top of 100vh, which equals 100% of the viewport's height.

h1 { margin-top: 100vh; }

Here is an example of how it can be used: https://example.com

Answer №3

To ensure that the video container div#videoBG takes up 100% of the viewport height, allowing you to impact inner elements like #mainHeader without affecting the section below, set its dimensions accordingly. Additionally, I included box-sizing: border-box and reset margins and padding to prevent gaps between sections.

If the embed snippet distorts the viewport height, please view it externally:

View External JSFiddle Here

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Manipulate an image with PHP and jQuery to rotate it, then store the edited image in a specified destination directory

This is not just a question, but an opportunity to share knowledge with many like-minded individuals. After spending hours working on rotating images dynamically using PHP and jQuery, I have come up with a solution that I believe will benefit others in the ...

Changing the entire content of a webpage from the server using AJAX

I am looking to update the entire page content with the click of a button, transitioning from Words.html to SelectNumber.html This snippet is from Words.html <html> <head> <meta charset="UTF-8"> <title>Number Game< ...

Component that dynamically changes background images in Vue

I'm currently working on a Vue banner that requires a dynamic background, but for some reason, it's not functioning as expected. I've experimented with different methods, and using an image tag like this works: <img :src="require(`@/asse ...

delivering the user's ID and username from php back to the website

Currently, I am in the process of creating a sign-in feature for my website (index.php): To achieve this, I have designed a form that will submit information to the validation-sign-in.php file for processing: (Encryption will be implemented at a later st ...

transferring color values from C# to ASPX style class

In my .NET C# project, I am trying to pass a color value from my C# code to an ASP.NET style class. The CSS for my class is as follows: <style> div.timeline-event { color: #1A1A1A; border-color: green; background-color:#EFD5F6; display: inline-block ...

jQuery command to display a div element when a button is clicked

Hey there, I'm trying to display a div element in jQuery mobile when the user touches the button. I have already created custom classes for both the button and div element but unfortunately, nothing seems to happen. Can anyone tell me which classes I ...

Mastering Data Transfer in jQuery: A Guide to Migrating Event Information from .on(dragstart) to

I need help with transferring information between an .on(dragstart) event and an .on(drop) event. However, when I run the code below in Chrome, I encounter an error message: 'Uncaught TypeError: Cannot read property 'test' of undefined' ...

Tips for displaying a modal pop up on top of another modal pop up

Recently, I encountered an issue with my Modal Pop Up. After clicking on a button within the Modal Pop Up, a second Modal Pop Up appeared but was partially hidden behind the first one. I am now seeking advice on how to ensure that the second Modal Pop Up d ...

How can you selectively add a CSS class during the iteration of a VueJs object?

Using Vuetify components: <v-layout row wrap> <v-flex xs2 v-for="(month, key) in months" :key ="key"> <router-link class = "decoration" :to="month.target">{{(month.month)}}</router-link> </v-flex> The "v ...

What could be the reason for the malfunction of basic javascript code?

HTML: <p id="demo"></p> Here is the script in JavaScript: document.getElementById("demo").innerHTML = 5 + 6; After adding a separate JavaScript file called myScript.js to contain the code, nothing is being displayed as expected. I linked th ...

Display 'Div 1' and hide 'Div 2' when clicked, then reveal 'Div 2' and hide 'Div 1' when a different button is clicked

I need help figuring out how to make two separate buttons work. One button should display 'Div 1' and hide 'Div 2', while the other button should show 'Div 2' and hide 'Div 1' when clicked. My knowledge of jquery an ...

VueJS encountered an issue while displaying the image

I am facing an issue with VueJS while trying to populate my index.html with images fetched from the iTunes API. The API returns a URL to an image, but I am struggling to render them on my webpage. The 'item' variable holds the object data. Initi ...

Troubleshooting problems with TranslateZ performance on mobile devices

While attempting to incorporate the code found at http://codepen.io/keithclark/pen/JycFw, I encountered significant flickering and delays in Chrome when using mobile devices. #slide1:before { background-image: url("http://lorempixel.com/output/abstract ...

Is the CSS3 bar chart flipped?

I'm currently developing a responsive bar chart, and everything seems to be going smoothly except for one issue - when viewing it in full screen, the bars appear to be flipped upside down. It's quite puzzling as all other elements such as text an ...

Enhancing security in client-server communication using HTML5 Ajax

Thank you for your assistance today. I am currently in the process of developing an HTML5 game and require guidance on the most effective method for Client Server communications. I am exploring alternatives to socket.io for undisclosed reasons. The key p ...

What is the best way to center elements within a Bootstrap dropdown menu that have become misaligned because of varying widths of icons preceding them?

I am currently working on a Bootstrap 4 dropdown menu where the clickable items consist of an icon and short text positioned next to the icon. I attempted to align both the icons and text within each element using a table layout, but it seems that the drop ...

Can you tell me the XPath of this specific element?

Looking for the XPath of this specific element: <a> href="/resident/register/">Register another device </a> I initially tried $x("//*[contains(@href, 'resident/register')]") Unfortunately, no results were returned. Any other su ...

CSS - Organization of Rows and Columns

I am in the process of designing a website that will feature news content, and I would like to give it a layout similar to a reddit news box. The layout would resemble the following structure. I am using angular material and CSS exclusively, without any fr ...

What is the best way to apply a png overlay to each img tag when hovered over?

Here is the code snippet I am working with: <div class="latest-post"> <a href="http://localhost/blaze/2011/documentaries/test-big-thumb" rel="bookmark"> <span> <img width="140" height="100" src="http:// ...

A guide on monitoring SASS files in all subdirectories with an npm script

Is there a way to watch all sass directories and generate CSS files to the corresponding 'CSS' folder, including subdirectories? The current method involves listing each directory separately in the NPM script. "scripts": { "sas ...