When attempting to set a video as the background on the landing page, the Z-Index feature does not seem to function correctly

As a beginner in front-end development, I decided to challenge myself by creating a web portfolio from scratch. To personalize my landing page, I wanted to use my video editing reel as the background, but for some reason, it just wouldn't work. Even with the help of a friend who is an experienced front-end developer, we couldn't figure out why the video always appeared in front of my logo and buttons. It seems like no matter what approach we tried, whether adjusting z-index or adding relative positioning, the issue persisted.

One factor that complicates things is my use of sass, which I am still learning. I suspect that there might be something in the sass code conflicting with the layout of the video/logo. Alternatively, there could have been a mistake in how I structured the HTML elements. At this point, I'm at a loss and would appreciate any insights on resolving this issue. Here is the link to my repository: https://github.com/rkgregory/modern_portfolio-master.

Below is a snippet of my code:

@import "config";
@import "menu";

* {
  box-sizing: border-box;
}

body {
  @include background;
  background: $primary-color;
  color: set-text-color($primary-color);
  height: 100%;
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

// ... 
<body id="bg-img">
  <header>
    <div class="fullscreen-video-wrap">
      <video src="./img/code.mov" autoplay="true" loop="true"></video>
    </div>

    // ...

  </main>

  <script src="js/main.js"></script>
</body>

If you notice anything crucial that I might have overlooked, please don't hesitate to share your thoughts. Thank you!

Answer №1

The z-index:-1 was not added to the video container but directly to the <video> element.

Modify as follows:

.fullscreen-video-wrap {
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
    width: 100%;
    height: 100vh;
    overflow: hidden;
 }
 .fullscreen-video-wrap video {
    min-width: 100%;
    min-height: 100%;
 }

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

Techniques for positioning text beside an image in a floating block

Despite experimenting with various display settings such as block and inline for text, I am still facing issues. Please take a look at my website: ...

Fluid design: prevent alteration in body width caused by vertical scrollbar

I have successfully implemented a liquid layout for my website by setting the body tag width to 100%. <html> <head> </head> <body> <div id="container"> some content </div> </body> body { mar ...

Creating a Design That Works Well on Both Desktop and Mobile Devices

I have created this design using CSS and Bootstrap. However, I am encountering an issue with responsiveness. Can someone assist me in making this design responsive? HTML: .ordering .spanone { position: absolute; width: 100px; left: 43%; right: ...

jsx eliminate parent based on dimensions

Imagine I have a DOM structured like this <div className="parent"> <div>child 1</div> <div>child 2</div> </div> If the view is on mobile, I would like the DOM to transform into <div>child 1</ ...

What could be causing my text-align: center; to not function correctly?

Can someone help me figure out why my text-align: center; is not working properly? I am trying to center both the text and the span within the image, but it's not displaying correctly. (I'm still learning, so I appreciate your understanding). Th ...

Using CSS to place my logo within the navigation bar

Currently, I am struggling to find tutorials that can assist me in aligning the responsive navigation bar with the logo. As a newcomer to HTML & CSS and website creation, I would greatly appreciate any guidance on positioning it correctly. Additionally, co ...

Align the <div> vertically within the <td> tag

My current set up looks something like this: <tr> <td> <div class="blue">...</div> <div class="yellow">...</div> </td> <td> <div class="blue">...</div> <div class="yellow ...

Can you provide guidance on how to use Javascript to submit a form specifically when the input name is labeled as "submit"?

Query: How can I use Javascript to submit a form when one of the form inputs is named submit? Scenario: I need to send users to another page using a hidden HTML form. Unfortunately, I cannot modify the names of the inputs in this form because it needs to ...

Discover the best way to implement aliases for embedded base 64 images within HTML code

I am trying to incorporate Base64 embedded images into my HTML file, but the image sizes are over 200k, making the base64 data part very large. To address this issue, I would like to place these images in another tag, such as a script, and attach them at ...

Tips for validating input fields in Ionic to display errors after the user has finished filling them out

*Hello, I'm new to working with AngularJS and I'm currently trying to display an error message after the user has finished typing in the input field. However, I'm encountering an issue where the error message appears as soon as I start typin ...

The display message in Javascript after replacing a specific string with a variable

I'm currently working on a task that involves extracting numbers from a text input, specifically the first section after splitting it. To test this functionality, I want to display the result using an alert. The text input provided is expected to be ...

Switch between displaying or hiding specific elements using Vue.js (Content Delivery Network)

I am currently utilizing Vue.js (cdn) and axios to fetch data from heroku and mlab. My goal is to showcase data from objects in a list, with each line acting as a button or having an onclick event that reveals more information from the same object below, ...

Steps to creating a proper cascade using the label statement

I am currently customizing the appearance of a checkbox. The HTML code in the file called fin1.cfm is as follows: <td>Master Event:</td> <td> <input type = "checkbox" id = "cb_e" name = "datesumm" value = "" > <label f ...

Can a Unicode character be overwritten using a specific method?

Is there a way to display a number on top of the unicode character '♤' without using images? I have over 200 ♤ symbols each with a unique number, and using images would take up too much space. The characters will need to be different sizes, a ...

Creating Table Rows on-the-fly

Seeking assistance and guidance from the community, I have modified code from an online tutorial to allow users to dynamically add rows to a table when data is entered in the row above. However, I am facing an issue where I can only insert one additional ...

Instructions for receiving user input and displaying it on the screen, as well as allowing others with access to the URL to view the shared input provided by the original user

<h1>Lalan</h1> <input type="text" name="text" id="text" maxlength="12"> <label for="text"> Please enter your name here</label> <br><input type="submit" value ...

Aligning a single component in the center vertically with the appbar positioned at the top of the screen using Material

As a beginner with material UI, I am facing challenges in centering a component both horizontally and vertically on my screen while including an AppBar for navigation at the top. While I have come across solutions like this example using a grid system, i ...

Enhance Your Website with HTML and JavaScript

Here is the code snippet I am working with: sTAT **javascript** var acc = document.getElementsByClassName("item-wrapper"); var i; for (i = 0; i < acc.length; i++) { acc[i].onclick = function(){ this.classList.toggle("selected"); this.nextElementS ...

AngularJS - Exchange data between controllers through shared scope

I've encountered a situation with a textarea in my HTML that looks like this: <textarea ng-model="commentBox"></textarea> In one of my controllers, I can easily access the content of the textarea using "$scope.commentBox". However, I&apo ...

My footer is now overlaying both my content and navbar

I am facing an issue with my footer. When I test my new footer, it ends up covering the content and navbar. I have been trying to figure out how to solve this problem but haven't had any luck yet. Hopefully, I can find some answers here... $(".toge ...