Image is positioned absolutely and appears when the parent element is flipped

I've encountered an interesting issue in Chrome (works perfectly in Firefox), and I'm unsure how to resolve it.

http://jsfiddle.net/GkXA7/1/ When hovering over the card, the image appears flipped on the backside. However, if I adjust the image's position from the right, this issue doesn't occur!? http://jsfiddle.net/GkXA7/2/

HTML

<div class="flip-container">
    <div class="flipper">
        <div class="front card">
            <img width="40" height="40" src="http://images3.wikia.nocookie.net/__cb20120330024139/logopedia/images/d/d7/Google_Chrome_logo_2011.svg">
            <h3>Front</h3>
        </div>
        <div class="back card">
            <h3>Back</h3>
        </div>
    </div>
</div>

CSS

/* Flip Effect */
.flip-container {
    perspective: 1000;
    margin: 0 auto 20px;
}
/* flip the pane when hovered */
.flip-container:hover .flipper, .flip-container.hover .flipper {
    transform: rotateY(-180deg);
    -webkit-transform: rotateY(-180deg);
}
.flip-container {
    width: 400px;
    height: 200px;
}
/* flip speed goes here */
.flipper {
    transition: 0.6s;
    transform-style: preserve-3d;
    position: relative;
    -webkit-transform-style: preserve-3d;
}
/* hide back of pane during swap */
.flipper .card {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    text-align: center;
    position: absolute;
    top: 0;
    left: 0;
    width: 400px;
    height: 200px;
}
.flipper .front{
    background-color:green;
}
.flipper .back{
    transform: rotateY(-180deg);
    -webkit-transform: rotateY(-180deg);
    background-color:red;
}
.front img{
    position: absolute;
    top:10px;
    left:10px;
}

Is there a way to prevent the image from appearing on the flip side while still being able to position it absolutely?

Answer №1

The image appears to be almost at the same depth as the backface, causing it to intermittently appear and disappear.

For the solution, check out the updated fiddle

The fix involved adjusting the CSS:

.flipper .back{
    transform: rotateY(-180deg)  translateZ(-1px);
    -webkit-transform: rotateY(-180deg) translateZ(-1px);
    background-color:red;
}

A single pixel can make a significant difference!

It seems I misunderstood your requirements initially, but now I have corrected the issue.

Take a look at the revised first fiddle

By adjusting the pixel translation to positive, the problem has been resolved.

The reason for the inconsistency in visibility between sides is a slight deviation from a perfect 180-degree rotation. It's more like 179.99 degrees, causing one side to be slightly lower and the other slightly higher.

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

Enhancing ag-grid with alternating row group colors following row span

My data structure is shown below: https://i.stack.imgur.com/fy5tn.png The column spanning functionality in ag-grid is working for columns 1 and 2 as expected. However, I am looking to implement alternate row colors based on the values in column 2 (animal ...

css center arrow-aligned underline text

Trying to emphasize my text with an additional arrow centered on the line is proving to be a challenge. When attempting this, the text does not align in the center of the page. .souligne { line-height: 17px; padding-bottom: 15px; text-transform: u ...

Designing a carousel-style menu list with navigation buttons for moving forward and backward

I'm running into some trouble while attempting to create a carousel. Firstly, the issue I am facing is that when you continuously click on the Next button, the function keeps working even after reaching the last item. I'm not sure how to make th ...

CSS: Handling Background Images Responsively

I'm experiencing an unusual issue where the image is not appearing, even though the div box shows up when I highlight elements on the page. Validation and inspection also show no issues. Here is the code: <div class="mainImage"></div> A ...

Implementing a delay between two div elements using jQuery

I have two Divs with the class "sliced", each containing three images with the class "tile". When I animate using jQuery, I am unable to add a delay between the "sliced" classes. However, I have successfully added a delay between the "tile" classes. index ...

Changing color when mouse hovers using Jquery

Currently, I am in the process of converting a flash ad into an html5 ad. I found this demo here, and I would like to replicate the mouse hover effect showcased. When the cursor hovers over the details text in the banner, the entire background changes to ...

Displaying images dynamically in a gridview from a hard drive source

I am facing an issue trying to dynamically retrieve an image from my hard drive. Despite creating the dynamic path correctly, the image is not displaying. The root cause of this problem lies in the fact that I am developing a back-end system for a website ...

Tips on removing a stylesheet while transitioning to another page in Vue

I'm new to Vue.js and I'm experimenting with adding and removing stylesheets in components using the mounted and unmounted lifecycles. Initially, I successfully added a stylesheet using the following code: mounted() { this.style = document. ...

What is the best way to automatically close a modal box after submitting a form?

Currently, I am utilizing the CSS modal box developed by Paul R. Hayes. More information about this can be found here - Within the modal box, I have integrated a form. This form is aimed at an iframe that remains concealed on the same page. My objective i ...

Tips for repairing the gray margins on the right and left sides of a webpage

Currently utilizing Bootstrap 5 and incorporating columns within the framework. However, encountering an issue where there is black space on the right side of the screen and certain content disappearing on the left side as demonstrated here. Here is the c ...

Unable to align a 1px element with the primary border

Can you please assist me? I would like to modify the CSS markup below in order to remove the 1 pixel added extra on the active clicked tab from my UL LI Tabbed Menu. How can this be achieved? Here is a picture of the issue: HTML Markup: <div class=" ...

Issue with QuickSand Script not displaying properly on Internet Explorer 7

My website features an edited version of Quicksand that displays correctly on Chrome, Opera, and Firefox, but runs into CSS issues on IE. Oddly enough, when I was using the static version, the CSS displayed properly even on IE until I added the Quicksand e ...

Adding up rows and columns using HTML

I've designed an HTML table to function as a spreadsheet, with the goal of being able to total up rows and display the sum in a cell labeled "Total." The same calculation should be applied to columns as well, with totals displayed in the last column c ...

What's the reason behind CSS transitions starting with a black background?

When I apply a transition to the heart, it inexplicably turns black at the start of the animation before displaying the intended gradient effect. Below is the code snippet: .heart { font-size: 2.5rem; padding-right: 2rem; } .heart:hover ...

Implement the CSS display flex property for more flexible layouts

After working on some HTML code, I found the following: <section class = "personal_proyects"> <article> <div class = "personal_details"> <h3>Canal YT: Codigo RM</h3> < ...

Discrepancy in Bootstrap Navbar Brand and Links color appearance when attempting to change font and color across entire navbar

As a newcomer to CSS, I am facing an issue with my navbar. I want both the navbar brand and navbar links to be the same size and color. However, when I try to change the font and color of the entire navbar, only the font changes and the color remains incon ...

Navigating Your Way Through the Center (ASP.NET MVC)

My navbar has elements that I want to center within it, but using margin hasn't been successful. Do you have any suggestions on how I can achieve this alignment using CSS? This is the code snippet: <div class="navbar "> <div class="cont ...

Display the user's chosen background image as the backdrop for my activity

As I've been exploring various corners of the internet, I've come across a potential technique for accessing the user's background from within my activity. I've brainstormed a couple of ideas (even though they might seem silly, just to ...

The image is not aligning properly within the navigation bar

I had some queries in mind: 1) How can I ensure that the circular profile image on the rightmost side fits within the header without overflowing? 2) How do I properly align the last three images at the bottom (in the "R" class), with adequate spacing bet ...

Is there a workaround utilizing calc() and vh specifically for Chrome browsers?

Is it possible to find a CSS-only solution for incorporating vh in calc() functions specifically for Chrome browsers? I am trying to implement calc(100vh - 25px) as the top margin in order to make a 25px bar stick to the bottom of the page, but I am facin ...