Issue with Firefox translateZ causing only half of the content to be visible on initial load in Pure CSS Parallax configurations

Recently, I've been experimenting with creating a parallax website and have been following the helpful steps outlined by Keith Clark. However, I've run into an issue that seems to be specific to Firefox. Upon loading the site, I noticed that the first layer and the darkseagreen background layer are being cut in half. If I adjust the translateZ property from -1px to 0, the elements load correctly but then the parallax effect stops working. After scrolling down or resizing the browser window, the rest of the content becomes visible, but I would prefer for it to display properly upon the initial load.

You can view my code on CodePen. I am using Firefox version 80.0.

.parallax {
    perspective: 1px;
    height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
}

.parallax__layer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 100vh 0;
    width: 100%;
}

.parallax__layer--base {
    transform: translateZ(0);
}

.parallax__layer--back {
    transform: translateZ(-1px);
    background-color: darkseagreen;
    width: 100%;
}

.title {
    position: absolute;
    left: 50%;
    top: 50%;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    color: #fff;
    text-align: center;
}

Answer №1

My situation involved an inherited 'overflow: hidden' that was causing unnecessary clipping of content in FireFox.

Upon reviewing the original documentation, I discovered:

An important guideline to remember when grouping elements is that we should avoid clipping the content of a group. Applying overflow: hidden to a parallax__group will disrupt the parallax effect. Unclipped content may lead to descendant elements overflowing, requiring a strategic approach with z-index values to ensure proper visibility as visitors scroll through the document.

This requires utilizing z-index in a clever manner, posing a challenge in my implementation, but one I can manage.

Specifically, by implementing intersection observers. Once a specific intersection point is reached, the z-index is adjusted. This adds complexity to the code, a concern for me, but it appears to be effective.

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

Do you need the Tooltip Module for Angular-bootstrap popover to work properly?

"Could it be possible that my popover isn't working because it requires the tooltip module just like the Bootstrap jQuery plugin?" Is this the reason my popover isn't functioning as expected? What exactly is the tooltip module and do I need to i ...

Using TypeScript, apply an event to every element within an array of elements through iteration

I have written the code snippet below, however I am encountering an issue where every element alerts the index of the last iteration. For instance, if there are 24 items in the elements array, each element will alert "Changed row 23" on change. I underst ...

The React MUI v5 Card's background features a subtle white hue with a 5% opacity, leaving me curious about its origin

I've noticed a strange styling issue in my code. It seems to be related to a class called .css-18bsee0-MuiPaper-root-MuiCard-root, possibly from MUI's Card or MUI's Paper components. However, I can't find it in my own code. While tryin ...

"Transforming the Website Background with a Splash of Color

I am trying to figure out how to change the color scheme of my website with a button click. Currently, when I select a different color, only the background of the webpage I'm on changes, not the entire website. I have applied CSS but it's not ref ...

Easily style Angular directives (whether they are custom or built-in) using the native handle for CSS

In my Angular application, I have directives set up as follows: <!doctype html> <html lang="en" ng-app="cfd"> <head> ... </head> <body> <div class="container"> <!-- Header --> <div ...

What is the most effective way to implement a CSS stylesheet on a particular individual element?

Just starting out in web development and I recently experimented with a CSS stylesheet on a basic HTML element. It worked great when I targeted the element by name like this: label { color: green; } However, I wondered if there was a way to apply sty ...

Unlocking the Power of NextJS Keyframes

After successfully creating a background with 3 images using keyframes in my initial project built with html and css, I decided to recreate the project using NextJS. However, I encountered an issue where the third image does not display in NextJS. Instead ...

Encountering a roadblock while trying to work with AngularJS Material radio buttons

In one of my projects, I have implemented a polling system where users can choose a question from a list and then proceed to the options page. On the options page, users can select their answer choices and submit their responses. The results are then displ ...

Display a loading image as a placeholder while the Block is loading on the Viewport

Despite my extensive search for a solution to my problem, I have been unable to find one that addresses it directly. I am trying to display a "loading" image for 4 seconds before the content of the div is loaded. Unfortunately, I haven't been able to ...

Issue encountered while trying to access PHP script within table data utilizing Ajax

I have a small project that involves displaying different news articles. I need to incorporate the news_all.php file into the table data in dashboard.php without using the include('news.php) function. Instead, I am utilizing Ajax methods to achieve th ...

ever-evolving background-image with dynamic CSS styling

Being new to both PHP and Javascript, please excuse any mistakes in my explanation. I have information stored in a PHP array that I bring to my index page using the function below (located in a separate file called articles.php that is included in my index ...

Issue with HTML: The heading is not aligned on the same line as the logo

My goal was to create a website dedicated to Manchester United merchandise. I started by inserting the logo and adjusting everything accordingly, but I encountered an issue where the heading and line I inserted were not aligned properly. Here is the proble ...

Steps to center an HTML canvas on the screen

I attempted to center my canvas horizontally using <div style="text-align:center;">, but the y axis remains unchanged. How can I position the HTML canvas in the center of both the x and y axes? Any suggestions on how to achieve this alignm ...

Performing a function when the ondrop event of a <li> element is triggered

Is there a way to trigger a code-behind click function on the ondrop event of an <li> element? Additionally, I would like to know if it's possible to force a postback on the onclick event. Any ideas on how to achieve this? Just to clarify, thi ...

What is the most common method for creating a dropdown menu for a website's navigation?

Is there a common approach to creating an interactive drop-down navigation menu in the industry? I have searched on Google and found multiple methods, but as a student working on my first big web project, I am hoping to find a standard practice. I don&apo ...

Steps for aligning a table in the middle of a webpage

Can someone help me align my table to the center of the webpage? I have tried using align="right" and "center" but neither seem to be working. Any tips on how to position the table correctly? <table style="table-layout:fixed;" align="right" cellspaci ...

How can you continuously calculate and show the total quantity of items in a list?

Currently, I have lists set up in my sidebar and I'm looking to include a label displaying the number of items within each list. To provide a better understanding of what I'm aiming for, I've put together a JSFiddle demonstration at the fol ...

Utilizing BootStrap for a more Dynamic and Reactive Web Design

Here is the HTML code I am using along with bootstrap: <div class="row"> <div class="col-sm-4" style="background-color:lavender;">.col-sm-4</div> <div class="col-sm-8" style="background-color:lavenderblush;">.col-sm-8</div> & ...

How come my image isn't cooperating with text-align and vertical-align?

Hey everyone! I'm a newcomer to this community and a newbie when it comes to HTML. :D I encountered a problem recently and discovered that Stackoverflow is full of amazing developers. That's why I've decided to share my problem here and am ...

Maintaining the layout of blank lines in HTML content within JEditorPane

It has come to my attention that in an HTML JEditorPane, when there is an empty line, any previously applied styling disappears. Take a look at the code snippet below: import javax.swing.JEditorPane; import javax.swing.JFrame; import javax.swing.SwingUtil ...