The CSS3 Transform feature kicks in only after the window is resized in Mozilla Firefox

I have created a pure CSS3 parallax webpage by following the method outlined by Keith Clark and using a sample made by Carl Henderson (I can't provide a direct link to his codepen due to my lack of reputation). You can find the code in the main page, on my JSFiddle, and also on Carl's Codepen.

index.html

<div class="plax_layer plax_layer--back">
    <p>Back Layer</p>
    </div>

    <div class="plax_layer plax_layer--base">
        <p>Base Layer</p>
    </div>

    <div class="plax_layer plax_layer--deep">
        <p>Deep Layer</p>
    </div>

</div>

main.css

html, body {
    height: 100%;
    overflow: hidden;
}
.parallax {
    top: 0;
    -webkit-perspective: 1px;
    -moz-perspective: 1px;
    -ms-perspective: 1px;
    perspective: 1px;
    height: 100vh;
   overflow-x: hidden;
}
.plax_layer {
   position: absolute;
   top: 0;
   right: 0;
   bottom: 0;
   left: 0;
   font-size: 200%;
   -webkit-transform-style: preserve-3d;
   -moz-transform-style: preserve-3d;
   -ms-transform-style: preserve-3d;
   -o-transform-style: preserve-3d;
   transform-style: preserve-3d;    
}
.plax_layer--base {
    -webkit-transform: translatez(0) scale(1);
    -moz-transform: translatez(0) scale(1);
    -ms-transform: translatez(0) scale(1);
    -o-transform: translatez(0) scale(1);
    transform: translatez(0) scale(1);
    border: 2px solid red;
}

.plax_layer--back {
    -webkit-transform: translatez(-1px) scale(2);
    -moz-transform: translatez(-1px) scale(2);
    -ms-transform: translatez(-1px) scale(2);
    -o-transform: translatez(-1px) scale(2);
    transform: translatez(-1px) scale(2);
    border: 2px solid blue;
}
.plax_layer--deep {
    -webkit-transform: translatez(-2px) scale(3);
    -moz-transform: translatez(-2px) scale(3);
    -ms-transform: translatez(-2px) scale(3);
    -o-transform: translatez(-2px) scale(3);
    transform: translatez(-2px) scale(3);
    border: 2px solid green;
}
p {
   position: absolute;
}

I'm facing an issue where the code works perfectly on Chrome and Safari, but Mozilla Firefox fails to display the desired effect unless I open the Inspector window (and stops when I close it). Additionally, it only works correctly in my Fiddle after I've resized the output window. So far, I haven't encountered similar problems with Google Chrome.

Answer №1

The issue was resolved when I included margin: 0 in the body CSS styling.

For more details, visit this link: http://example.com/css-fix.

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

AngularJS: Solving the issue of controllers not exchanging data by utilizing a service

I am working with the following controllers and service: angular.module('myApp', []); angular.module('myApp').factory('ShareService', function() { var information = {}; information.data = ""; information.setD ...

Struggling to retrieve a JSON object from an Express and Node application, only receiving an empty result

Can anyone assist me? I'm having trouble with the res.json() function in my code. It seems to work after the first request, but not after the second. Right now, my application is quite simple - it scrapes user data from social media platforms like Twi ...

Enhanced jQuery Embed Code validation for user input using a textarea

Currently, I am developing a website that allows users to input embed codes from popular platforms such as Twitter, YouTube, Instagram, Facebook, and so on. The embed code undergoes validation checks and is saved if it meets the criteria. However, when us ...

Creating a dynamic collection of N triangles in a container using CSS

In my current project, I am developing an Electron+Vue application that features a grid-styled map. Each cell on the map represents a room, and I want to indicate walls within these cells. Specifically, for directions North, South, East, and West, I can us ...

Exploring the integration of HTML and CSS within the Django framework

Trying to implement a star rating in a specific HTML file The file I am working on is called book_detail.html {% extends "base.html" %} {% load static %} {% block title %} Block Detail Page {% endblock title %} {% block sidenav %} {% for item ...

Adjusting the display property using the CSS plus symbol operator

I am currently in the process of designing a dropdown menu using CSS. The focus is on utilizing the following code snippet: #submenu_div { display: none; } #li_id:hover + #submenu_div { display: block; } UPDATE: Here is the corrected HTML structure ...

"Exploring the World of Mobile Development and Screen Size

Currently, I am in the process of creating a basic mobile website that can be accessed through a QR code leading to the page linked below. However, I have encountered an issue where viewing it on my Android or Apple phone results in excess width. Any advic ...

Guide on setting the BackColor of a table cell based on a database value dynamically

In the project I am currently working on, there is a request to change the background color of specific table cells based on their values. In order to achieve this, I am handling the RadGrid_ItemDataBound event and attempting to set the BackColor property ...

HTML 5 Video VTT File: A must-have for optimal video playback

Having trouble getting the subtitle.vtt file to load on Chrome with this code. Can anyone offer any insights? <div id="videoKilledTheRadioStar"> <video id="Tutorial" width="420" autoplay controls> <source src="videos/shaco.mp4" type="vi ...

Comparing memory usage of Firefox and Chrome in WebDriver testing

I'm aiming to optimize the number of browsers that can run a script on my computer. Is there a way to determine the memory usage of each Chrome or Firefox process when launching webdriver? For instance: from selenium import webdriver driver = webdriv ...

When choosing the child option, it starts acting abnormally if the parent option is already selected in Angular

I am encountering an issue while trying to select the parent and its children in the select option. The concept is to have one select option for the parent and another for the child. I have parent objects and nested objects as children, which are subCatego ...

Adjusting the inner div dimensions to be 100% of the body's size without relying on the parent div using JavaScript

I have a main layer with multiple layers stacked on top of it. I need the second layer to extend its width to match the body's width. Main Project: http://example.com What I've tried: I looked into: Solution for matching div width with body ...

Can Vue.js 3 composition be leveraged with v-for to incorporate a query string into a router-link?

I have successfully implemented v-for for a URL path. Now, I am looking to merge the URL path with the query string in the router link tag. The query string will be the date from each item rendered by v-for. Is there a way to dynamically pass this query ...

Eliminate any additional spacing within the pre/code tags

I am currently utilizing prism.js for code highlighting. I have encountered an issue where there are unnecessary white spaces at the top and bottom of my output. You can view a live example here. <pre> <code class="language-css"> &lt ...

Unraveling a Java String with HTML elements into a JsonObject: Step-by-step Guide

Hey there, I have a Java String that was received from an HTTP request and it looks like this: {SubRefNumber:"3243 ",QBType:"-----",Question:"<p><img title="format.jpg" src="data:image/jpeg;base64,/9j/4AAQSkZJRgAB..."></img></p>"} ...

Exploring the Depths of Google Chrome: Unleashing the Power of

While a similar question has been posed previously, I am encountering difficulties debugging Javascript in Google Chrome. When I navigate to Page > Developer, the "Debug Javascript" function (Ctrl+Shift+L) is not active. Even trying Alt + ` does not seem ...

Guide on storing images in a designated folder using CodeIgniter

My code is located in view/admin_view2.php <?php echo form_open_multipart('home_admin/createBerita'); ?> <div class="form-group" > <label class="control-label">upload foto</label> <inpu ...

Is there a way to use javascript to ensure that CSS variables stick even when overwritten by onclick events?

I have successfully implemented a method to change CSS variables using advice found here. However, I am running into an issue where the changes do not persist. After clicking on a navigation link, the styles momentarily switch to the new values but quickly ...

What is the trick to getting an accordion to expand when hovering, rather than when clicking?

Can the accordion be set to expand when hovering instead of clicking? Also, how can a different action be triggered on click? LATEST I was specifically referring to using the jQuery UI accordion widget for this functionality. ...

Dissipating visuals / Effortless website navigation

Do you have experience working with HTML or are you looking for specific code examples? I've noticed some websites with sliders that feature clickable images fading in as soon as the page loads. I tried searching for information on how to achieve thi ...