The 3D hover effect is malfunctioning in the Firefox browser

I've been working on a 3D hover effect and my code is functioning properly in Opera and Chrome, but for some reason it's not working in Firefox. I've even attempted using vendor prefixes, but to no avail. The strange thing is that when I remove the anchor tag from my HTML, the code works perfectly in all browsers. However, I do need that anchor tag and with it, the effect fails to work in Firefox.

.wrapper {
     width: 50vw;
    height: 50vh;
    transform-style: preserve-3d;
    transform: rotateX(45deg) rotateZ(35deg) ;
    position: relative ;
    left: calc(50% - 25vw) ;
    top: calc(50% - 25vh) ;
}
.link {
    display: inline-block;
    width: 100%;
    height: 100%;
    position: absolute;
}
.wrapper * {
    width: 100%;
    height: 100%;
    position: absolute;
    transition: all .4s ease-in-out;
}
.wrapper  img {transition: all .4s ease-in-out;
}
.layer {z-index: -1;background-color: #5debb4;       
}
.wrapper:hover img {transform: translateZ(10vmin);
}
.wrapper:hover .layer{transform: translateZ(6vmin);
}
<!DOCTYPE html>
<html lang="en">
<head>
    <style>

    </style>
</head>

<body>
    <div class="wrapper">
        <a href="https://google.com" target="_blank" class="link">
            <img src="https://images.unsplash.com/photo-1555919040-66d6d368cfc4?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1225&q=80">
            <div class="layer"></div>
        </a>
    </div>
</body>
</html>

Answer №1

Make sure to also include transform-style: preserve-3d; in the link:

.wrapper {
  width: 50vw;
  height: 50vh;
  transform-style: preserve-3d;
  transform: rotateX(45deg) rotateZ(35deg);
  position: relative;
  left: calc(50% - 25vw);
  top: calc(50% - 25vh);
}

.link {
  display: inline-block;
  width: 100%;
  height: 100%;
  position: absolute;
  transform-style: preserve-3d;
}

.wrapper * {
  width: 100%;
  height: 100%;
  position: absolute;
  transition: all .4s ease-in-out;
}

.wrapper img {
  transition: all .4s ease-in-out;
}

.layer {
  z-index: -1;
  background-color: #5debb4;
}

.wrapper:hover img {
  transform: translateZ(10vmin);
}

.wrapper:hover .layer {
  transform: translateZ(6vmin);
}
<div class="wrapper">
  <a href="https://google.com" target="_blank" class="link">
    <img src="https://images.unsplash.com/photo-1555919040-66d6d368cfc4?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1225&q=80">
    <div class="layer"></div>
  </a>
</div>

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 best way to display a list of database records using Django?

Is there anyone who can assist me with this? I have a list of 60 records from a Django database in my HTML file. My goal is to display that list in a table with 6 columns and 10 rows. However, when using the {% for %} command in the HTML file, the list app ...

Stylesheet compilation with SCSS scripts

I am facing an issue with prefix:css. I am not very familiar with the scss build process, so if anyone knows what the problem is, please help me out. "watch:sass": "node-sass src/styles/global.scss src/assets/css/style.css -w", ...

Animation for maximum height with transition from a set value to no maximum height

While experimenting with CSS-transitions, I encountered an unusual issue when adding a transition for max-height from a specific value (e.g. 14px) to none. Surprisingly, there is no animation at all; the hidden elements simply appear and disappear instant ...

Trouble with Unveiling the Secondary Accordion

I am having issues adding a second accordion next to the existing one. Even though the code is working fine in the tryit editor v3.6 online, it doesn't seem to display correctly for me. I have made sure that I am using the latest versions of all scrip ...

What happens with the styling in this project when the CSS file is blank?

As a first-year CS student in university, I have been diving into the world of React.js. Currently, I am exploring a resume project and noticed that both app.js and index.js files are empty. I am curious to know how the styling is achieved in this project. ...

The Next.js Image component does not implement the maxWidth attribute

<Image src="/assets/blog/image.webp" style={{ maxWidth: "700px" }} width={1400} height={1400} /> Issue Detected The image with src '/assets/blog/image.webp' has the following styles applied, but they are being overwrit ...

Minimizing Jitter in HTML5 and JavaScript Applications

I am currently working on developing a metronome as a hobby using JavaScript/HTML5 with the intention of turning it into a FirefoxOS app. One issue I've encountered is Jitter, which is unacceptable for Metronomes. As JavaScript is single-threaded and ...

What is the process to obtain the child theme URL in WordPress?

Currently, I am working on creating a child theme for my WordPress website. I have successfully uploaded the assets folder which contains both CSS and JavaScript files. This child theme will be completely customized to suit my needs. Within the <head&g ...

What is the best way to limit the number of items displayed in a Bootstrap card?

While using bootstrap cards to display content, I encountered an issue when integrating it with the backend for looping. The items were continuously added to the right side instead of being set in columns of 3 and continuing straight down. It should look ...

Removing Inline Styles Using jQuery Scroll Event

Whenever I reach the scroll position of 1400 and then scroll back to the top, my chat elements (chat1, chat2, chat3, chat4) receive an "empty" inline style but only for a duration of 1 second. After that, the fadeIn effect occurs again every time I scroll ...

Use HTML input to enter numbers that are not written in the English language

I am facing an issue with my ASP .Net core web application where I am using Devextreme controls. The main requirement for my application is to support both Persian and Arabic languages, including numbers and dates. I have set up my local windows keyboard ...

Issues with Gulp Autoprefixer Functionality

I'm struggling to make Autoprefixer work with Gulp. Despite using opacity, gradients, and transforms in my CSS, I can't see any vendor prefixes being added. However, everything else seems to be functioning correctly. Below is my gulp file: var ...

How to add a line break within the :after pseudo-element using CSS

I've been struggling to split text inside an :after pseudo-element of a label that receives its content from a data- attribute. I've attempted using word-break, as well as playing around with width, max-width, and position:relative, but nothing s ...

Utilize jQuery setInterval to dynamically add and remove classes on elements

My goal is to display my image in a way that resembles waving flames. I decided to achieve this effect by using two layers (flame tongues) stacked on top of each other in the same position. My initial approach was to hide one flame tongue while showing the ...

Is it required for IDs in CSS to always correspond to a single element? How should IDs be handled if the same element is repeated multiple times on

Is it possible to have a menu that is visible at both the top and bottom of an extensive HTML page using the following code: <div id="menu"><ul><li>Home</li><li>About</li></ul></div> Would it be appropriate ...

Deciding Between Two Columns or One Column for Your JQuery Accordion

I am currently working on customizing an Accordion that is too large in height for my liking. My goal is to convert the single column layout into a two-column display, side by side. Having multiple items in one column results in excessive height, hence t ...

Failure to send chat form

I have been developing a PHP chat application and everything is working well. However, I am looking to implement AJAX in order to prevent the page from refreshing. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></s ...

Is there a way for me to adjust the window's placement?

Currently utilizing Jquery to launch a new Telerik window, as shown below: var win = $('#myWindow').data('tWindow'); win.open(); With the knowledge of the mouse position (x,y), my goal is to initiate the window at that exact location. ...

js TouchEvent: When performing a pinch gesture with two fingers and lifting one of them up, how can you determine which finger was lifted?

I am currently working on a challenging touching gesture and have encountered the following issue: let cachedStartTouches: TouchList; let cachedMoveTouches: TouchList; function onStart(ev: TouchEvent) { // length equals 2 when two fingers pinch start ...

Is there a way to select multiple items using the same xpath in Python Selenium by clicking on them?

I am facing a challenge with my webpage code. The code snippet below presents a radio button setup: <label data-correct="false"> <input type="radio" ng-model="quizCtrl.state.selectedOptionForCurrentQuestion&quo ...