Elevated Positioning of Footer in Bootstrap

Hello, thank you in advance for any help offered. The website in question can be accessed through this link: caulfield.co/test/

I am working on implementing a parallax footer reveal effect using Bootstrap 4. I am having difficulty adjusting the z-index of the fixed-bottom footer to ensure it is hidden behind the body div and only revealed after scrolling to the bottom. Despite trying to modify the z-index property, nothing seems to change. I suspect that there may be something in the CSS of Bootstrap causing this issue, but I am unsure where to begin looking. Can someone provide assistance?

CSS:

.body-temp{
  height:1000px;
  margin-bottom:300px;
  background-color:black;
  z-index:5000;
}


/* Footer
-------------------------------------------------- */

footer{
  height:300px;
  background-color:#232323;
  margin: 0 auto;
  text-align:center;
  font-weight:300;
  font-size:.8rem;
  color:#666666;
  z-index: -1000;
}

HTML:

<div class="container body-temp">
  </div>


  <!-- Footer -->
      <footer class="container-fluid fixed-bottom">
        <a class="" href="#">
          <img class="grow" id="footer-logo" src="images/mb-white.svg" alt="Margaret Biggs Fine Art">
        </a>
        <p>&copy; 2018 Margaret Biggs</p>
        <div>
          <a class="footer-icons" href="#">
              <i class="fab fa-linkedin-in"></i>
          </a>
          <a  class="footer-icons" href="#">
              <i class="fab fa-facebook-f"></i>
          </a>
        </div>
      </footer>

Answer №1

Indeed, this is a case of Bootstrap overriding your CSS due to specificity.

You included the Bootstrap class fixed-bottom, which has a z-index of 1030.

The selector footer will not be able to override it.

To override Bootstrap using specificity, utilize footer.fixed-bottom.

In regards to body-temp, it currently has a position: static, which does not interact correctly with z-index. To rectify this, include position: relative in your body-temp styles.

Check out the MDN DOCS on z-index for more information.

"For a positioned box (that is, one with any position other than static), the z-index property specifies: ..."

I hope this explanation proves helpful :)

Answer №2

The easiest way to address this issue is by adjusting the position of the .body-temp element as shown:

.body-temp {
    position: relative;
}

In addition to that, I recommend enclosing the entire .body-temp element within a wrapper and setting the background color for the wrapper element:

HTML

<div class="body-wrapper">
    <div class="container body-temp"></div>
</div>
<footer class="container-fluid fixed-bottom">
    <a class="" href="#">
        <img class="grow" id="footer-logo" src="images/mb-white.svg" alt="Margaret Biggs Fine Art">
    </a>
    <p>© 2018 Margaret Biggs</p>
    <div>
        <a class="footer-icons" href="#">
            <i class="fab fa-linkedin-in"></i>
        </a>
        <a class="footer-icons" href="#">
            <i class="fab fa-facebook-f"></i>
        </a>
    </div>
</footer>

CSS

.body-wrapper {
    position: relative;
    z-index: 5000;
    background-color: #fff;
}

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

What is the strategy used by jQuery to select elements by class name?

Is there a "getElementsByClass" function in JavaScript? If not, how does jQuery manage to do it without looping through all elements which would be very inefficient? Also, how can I specify CSS for elements with two or more classes? <a class="one two ...

"Customize Bootstrap layout to have a stable width for desktop screens and a flexible width for

I received a psd design with a background for html5-bootstrap development that needed to be responsive. The original psd had a width of over 1200px, with the main container around 900px wide and the background displaying correctly. When converting to HTML ...

Tips for maintaining the original height of an image within an <img> element using HTML and CSS

I am facing an issue with a grid where I add grid-items, and then use the thumbnail class to provide dimensions to the thumbnail. When I insert an image into the <img> tag, it alters the height dimension, which is not desirable. I want the thumbnail ...

A step-by-step guide to invoking a function upon submitting a form with an external JavaScript file

How can I execute a function when the user submits a form using an external JavaScript file? index.html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>example</title> ...

Issue with scroll animation across multiple div elements

I am working on a project where I have two main divs, one with the id of "left-div" and the other with the id of "right-div". In the "left-div", there are multiple nested divs each with their own unique id. The overflow-y property of the "left-div" is set ...

What causes inline CSS and internal CSS to exhibit different behaviors?

It’s kind of strange that I have to click twice to see Foo’s content, but only once to see Bar’s content. The main difference seems to be that Foo’s content has internal style while Bar has inline style. <html> <head> <style> ...

Imagine a scenario where clicking on an image causes it to be rotated or

Could use some assistance figuring out what's missing here. I've added a random photo from Wiki, similar in size to the images I'll be working with. The images will vary in size, but I want them to always remain visible within the browser w ...

Formatting tabular rows to appear as headers

I am currently developing a mobile website that is specifically designed for older phones with minimal CSS and HTML support. Due to these limitations, I have decided to utilize tables in my design. My goal on a certain page is to create a table row with a ...

Is the footer consistently at the bottom of the page, expanding the container alongside it?

Looking to ensure that my footer remains at the bottom of the site, with the container expanding when there isn't enough content to fill the browsing window. Additionally, as new data is added to the menu or information block, the container should str ...

Dynamic Code for Removing List Items Based on Date

I need assistance in resolving an issue with my company's website design and function. Specifically, I am working on a page that displays a list of events where employees will be present throughout the year. Here is an example: <div class="contai ...

Tips for updating the left positioning of a Div element on the fly

Although my title may not fully explain my goal, I am dealing with dynamically created div elements. When a user triggers an ajax request to delete one of the divs, I want to remove it from the DOM upon success. The issue arises in adjusting the layout aft ...

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 ...

Height and width not being properly set by Ngx-Bootstrap popover

Struggling to integrate ngx-bootstrap into my Ionic 2 / Angular 2 application. The popover seems to be having issues with its display in the view: <button placement="right" [outsideClick]="true" popover="this is a test text for the popover conten ...

Tips on implementing a circular progress bar with locomotive scroll functionality

Can anyone help me integrate progress functionality with Locomotive Scroll using JavaScript? Link to CodePen for reference Check out this code snippet from Locomotive Scroll that calculates the percentage of pages scrolled: const scroller = new Locomotiv ...

Tips for properly nesting a "carousel" div within an "oe_structure" without any overlapping issues

Having trouble with placing a "carousel" div inside the "oe_structure" in my odoo template. I am currently working on editing the "website_sale.products" template. As a newcomer to Odoo, can I use inheritance in my direct code to make edits? I'm stil ...

Div slicing with CSS

Is it possible to slice a div from either side, for example, taking a portion of the left side and making it transparent while keeping everything else in place? For instance, if there is a div named "box" with CSS styling: #box { width:100px; heig ...

Tips for expanding an md-nav-item in Angular Material

Need help on stretching the md-nav-item element illustration 1 ------------------------------------------------ | ITEM1 | ITEM 2 | ------------------------------------------------ illustration 2 ------------------------------------------------ | ...

What could be causing my hamburger icon to malfunction?

https://codepen.io/anon/pen/QNqgMo Curious why the top line of the animation isn't moving. Any code wizards out there who can spot the mistake? Appreciate it! #hamburger-icon.active .line-1 { transform: translateY(25px) translateX(0) rotate(45deg); ...

Having trouble implementing responsive image with fixed aspect ratio code

I've tried several tutorials online to make this image responsive with a fixed aspect ratio, but nothing seems to work. The image is set at 900x400px and I want it to remain fully visible on smaller screens as well. Here's the codepen link < ...

Having trouble navigating menus and submenus?

Customizing CSS Styles On my website, I have two different classes: menu and leftside. Both classes include the ul and li elements. However, when I try to use ul and li in the left side as well, they end up matching with the styles of the menu ul and li. ...