The text appears in the header instead of a separate section in Bootstrap 4

I am facing an issue with my one-page website where the new text section appears in the header video instead of after it. Can someone point out what I might be doing wrong?

Here is my HTML:

<header>
<div class="container">
  <div class="bg-wrap">

      <video poster="poster.png" autoplay="true" loop muted>
      <source src="img/video.mp4" type="video/mp4">
      <source src="img/video.webm" type="video/webm">
    </video>

    <div class="header-text">
      <h1>Elektro Sikora</h1>
      <p>Informační portál Elektro Sikora Český Těšín</p>
    </div>

    <div id="scroll">
      <div class="round">
        <div class="wheel"></div>
      </div>
      <div class="scrolling">
        <span class="arrow"></span>
      </div>
    </div>
  </div>
  </div>
</header>

  <section id="content-space">
    <div class="container">
      <div class="row">
        <div class="col-lg-12 text-center">
          <p>
            Kompletní nabídka produktů, které nabízíme. Najdete zde od elektroniky až po zdravou výživu.
          </p>
        </div>
      </div>
    </div>
  </section>

And here is my CSS:

/* Nav */
.navbar {
  padding: 1,2rem;
}
/* Video */
.bg-wrap {
  position: fixed;
  z-index: -1000;
  width: 100%;
  height: 100%;
  overflow: hidden;
  top: 0;
  left: 0;
}
video {
  top: 70px;
  left: 0;
  min-height: 100%;
  min-width: 100%;
}
.header-text {
  position: absolute;
  width: 100%;
  min-height: 100%;
  z-index: 1000;
  background-color: rgba(0, 0, 0, 0.4);
}
.header-text h1 {
  text-align: center;
  font-size: 65px;
  text-transform: uppercase;
  font-weight: 300;
  color: #fff;
  padding-top: 15%;
  margin-bottom: 10px;
}
.header-text p {
  text-align: center;
  font-size: 20px;
  letter-spacing: 3px;
  color: #fff;
}
#scroll {
  cursor: pointer;
  display: block;
  position: absolute;
  bottom: 50px;
  left: 50%;
  z-index: 1000;
}
.round {
  height: 21px;
  width: 14px;
  border-radius: 10px;
  transform: none;
  border: 2px solid #fff;
  top: 170px;
}
.wheel {
  animation-delay: 0s;
  animation-duration: 1s;
  animation-iteration-count: infinite;
  animation-name: scrolling;
  animation-play-state: running;
  animation-timing-function: linear;
  background: #fff none repeat scroll 0 0;
  border-radius: 10px;
  height: 3px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  top: 4px;
  width: 2px;
}
.scrolling span {
    display: block;
    width: 5px;
    height: 5px;
    -ms-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -webkit-transform: rotate(45deg);
    transform: rotate(45deg);
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    margin: 3px 0 3px 5px;
}
.arrow {
    margin-top: 6px;
}
header {
  height: 100vh;
  overflow: hidden;
}

The navigation disappears and the video becomes scrollable

Answer №1

Given that the video element has a CSS property of position: absolute;, it exists outside of the normal document flow. To make this setup work correctly, you must specify a height for the header element.

header {
    height: 100vh;
    overflow: hidden;
}

I believe implementing this adjusted CSS will resolve the issue you are experiencing.

/* Navigation Styles */
.navbar {
  padding: 1.5rem;
}

/* Video Style */
.bg-wrap {
  position: absolute;
  z-index: -1000;
  width: 100%;
  height: 100%;
  overflow: hidden;
  top: 0;
  left: 0;
}

video {
  position: relative;
  top: 70px;
  left: 0;
  min-width: 100%;
  background: black;
}

.header-text {
  position: absolute;
  top: 0;
  width: 100%;
  min-height: 100%;
  z-index: 1000;
  background-color: rgba(0, 0, 0, 0.4);
}

.header-text h1 {
  text-align: center;
  font-size: 65px;
  text-transform: uppercase;
  font-weight: 300;
  color: #fff;
  padding-top: 15%;
  margin-bottom: 10px;
}
.header-text p {
  text-align: center;
  font-size: 20px;
  letter-spacing: 3px;
  color: #fff;
}

#scroll {
  cursor: pointer;
  display: block;
  position: absolute;
  bottom: 50px;
  left: 50%;
  z-index: 2000;
}
.round {
  height: 21px;
  width: 14px;
  border-radius: 10px;
  transform: none;
  border: 2px solid #fff;
  top: 170px;
}
.wheel {
  animation-delay: 0s;
  animation-duration: 1s;
  animation-iteration-count: infinite;
  animation-name: scrolling;
  animation-play-state: running;
  animation-timing-function: linear;
  background: #fff;
  border-radius: 10px;
  height: 3px;
  width: 2px;
  margin-left: auto;
  margin-right: auto;
}
.scrolling span {
  display: block;
  width: 5px;
  height: 5px;
  -ms-transform: rotate(45deg);
  -o-transform: rotate(45deg);
  -moz-transform: rotate(45deg);
  -webkit-transform: rotate(45deg);
  transform: rotate(45deg);
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  margin: 5px 0 5px 5px;
}
.arrow {
  margin-top: 6px;
}

header {
  height: 100vh;
  overflow: hidden;
}

.container {
  height: 100%;
  width: 100%;
}
<header>
<div class="container">
  <div class="bg-wrap">

      <video poster="poster.png" autoplay="true" loop muted>
      <source src="img/video.mp4" type="video/mp4">
      <source src="img/video.webm" type="video/webm">
    </video>

    <div class="header-text">
      <h1>Elektro Sikora</h1>
      <p>Informační portál Elektro Sikora Český Těšín</p>
    </div>

    <div id="scroll">
      <div class="round">
        <div class="wheel"></div>
      </div>
      <div class="scrolling">
        <span class="arrow"></span>
      </div>
    </div>
  </div>
  </div>
</header>

  <section id="content-space">
    <div class="container">
      <div class="row">
        <div class="col-lg-12 text-center">
          <p>
            Explore our wide range of products, from electronics to healthy nutrition choices.
          </p>
        </div>
      </div>
    </div>
  </section>

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

Utilizing CSS to Properly Position HTML Elements

Check out my code on jsFiddle I'm facing some challenges in positioning HTML elements using CSS. While I grasp the fundamental concepts of block and inline elements, implementing them in real coding scenarios can be confusing. I've shared my HTM ...

How to customize the footer in Vuetify's list, menu, and combobox components

I've been struggling to add a footer to the Vuetify components like lists, menus, and comboboxes. Despite trying numerous CSS solutions, I haven't found one that works. What I'm aiming for is to have a fixed bottom button visible at all tim ...

Modify the text inside a div based on the navigation of another div

Hey there, experts! I must confess that I am an absolute beginner when it comes to JavaScript, JQuery, AJAX, and all the technical jargon. Despite my best efforts, I'm struggling to grasp the information I've found so far. What I really need is ...

Creating dynamic styles in ReactJS using the makeStyles feature

My theme is unique and I excel in theming. Currently, I have developed three distinct styles using material UI tabs. To modify these styles, I am utilizing makeStyles. Below is an example of the tab that requires modification: ... const useStyles = make ...

The navigation bar is positioned at the forefront, blocking any elements from being displayed beneath it

I just started using Bootstrap and I'm facing an issue with my navbar. No matter what I do, anything I place goes behind it. Even with margins and the native padding from Bootstrap, I can't get the distance right because the div that I want to mo ...

How to loop through a list variable using Razor syntax in an HTML document

Exploring the world of asp .net and MVC is a new adventure for me. I have delved into a service method named Jumbo(), which delivers a list consisting of first names, last names, and contact numbers. In my main project, I invoke this method in the followin ...

Ways to widen a selected drop-down menu outside the dialog box containing it

I'm working with a Html.DropDownList that has been styled using Chosen within a jQuery UI dialog. As the list of items is quite long, when it's opened, it gets cut off by the border of the dialog window. Is there a way to extend the dropdown por ...

What are the steps to ensure HTML5 video fills the entire height and width of the browser window?

Is there a way to make a video fill the entire width and height of the browser on first page load using bootstrap? I am currently facing some issues with achieving this. The code that I have been using seems to work, but the height ends up being more than ...

Move the footer to the bottom of the content

I'm struggling to position my footer directly after the last div on my page, as it's appearing lower than I'd like. Can anyone assist with this issue? Here is the code snippet: <div id="container"> <div id="header"> ...

What causes the table to expand with new cells once the database information is shown?

I'm confused as to why an empty cell is being added to the right even if there is data from the database to display. This particular code is meant to showcase a school schedule. Attached is a picture showing how it currently appears. Below is the PH ...

Getting rid of the arrow icons in a Material UI TextField

I am facing a challenge with removing the up and down arrow icons from a Material UI TextField that I adjusted using the Material UI documentation (https://material-ui.com/components/autocomplete/#autocomplete) Highlights section. After trying various sol ...

What is the significance of using "your-shop" as the action form without a file extension?

I've come across filenames (with file extensions) or URLs inside the action attribute of a form, but I have never seen code like this before: <form action="your-shop" name="shop_name_form" id="shop_name_form" method="post" onsubmit="return check_s ...

Tips for incorporating multiple choices on the PayPal checkout page or creating a dedicated page for various options

I am seeking guidance on how to offer multiple donation options on a checkout page. Imagine a non-profit organization with several different programs. They want to provide users the opportunity to donate to specific programs, in varying amounts, all at on ...

Tips for aligning elements vertically within a <td> tag

I am looking to vertically align 3 elements within my <td> tag, specifically in the center/middle. These are the elements I want to align: An image button (a tag) with a top arrow image A jQuery slider Another image button (a tag) with a bottom arr ...

Location of the html header navigation bar and main content area

Seeking assistance with HTML, CSS, and Bootstrap. I'm trying to create a template for my website that includes a top header, a side navigation bar, and a main section. However, I am struggling to position these elements correctly. The side navbar is a ...

The Bootstrap menu is having trouble collapsing properly

We're currently in the process of constructing a website using bootstrap, but we've encountered an issue with the menu bar. Upon visiting , you'll notice that the top menu functions properly and collapses perfectly when viewed on mobile dev ...

identifying the element targeted on dynamically created links with the help of jquery

I have created dynamic links where clicking on a country link displays the cities of that particular country. I am trying to retrieve the event.target.id of the dynamically generated city link when it is clicked. $(".countryName").children().on('cl ...

What is the best way to determine font size based on the width of the

In order to ensure that certain elements on my page do not exceed specific widths, it is crucial for me to use a monospaced font. This will limit the horizontal "stride" between characters to stay within a specified threshold. However, simply setting the ...

Menu remains open and unresponsive in Bootstrap

This is an HTML site built using Bootstrap. The site has a menu that should automatically open on mouseover, but currently, it does not close automatically. (function($){ $(document).ready(function(){ $('ul.nav [data-toggle=dropd ...

What could be causing the reliability issue with this particular Angular JS code for dropdown menus?

Attempting to create a dynamic country-city dropdown menu using AngularJS <div> Country: </br> <select data-ng-model="country" ng-options="country.name for country in countries" data-ng-change="updateCountry(country) ...