Shifting the order of cards along the Z axis

I have been working on my portfolio and have incorporated flipping cards to showcase my android apps. When someone hovers over the cards, they flip and zoom in to display a brief description.

The issue I am facing is that the lower cards are overlapping the ones above them when hovered over. I have tried using z-index but without success.

Here is the CSS code for the cards:

/* Card */
    .card-wrapper {
        -webkit-perspective: 1000;
        -moz-perspective: 1000;
        perspective: 1000;

        border: 1px solid #ccc;

        margin: 50px;
        display: inline-block;
        visibility:hidden;
        width:400px;
        height:540px;
        z-index: 2;

    }


        .card-wrapper:hover .flipper, .card-wrapper.hover .flipper {
            -webkit-transform: rotateY(180deg) scale(1.5,1.5) translate(10%, 10%);
            -moz-transform: rotateY(180deg) scale(2,2);
            transform: rotateY(180deg) scale(2,2);
            position: relative;

        }

    .card-wrapper, .front, .back {

    }

    .flipper {
        -webkit-transition: 0.6s;
        -webkit-transform-style: preserve-3d;

        -moz-transition: 0.6s;
        -moz-transform-style: preserve-3d;

        transition: 0.6s;
        transform-style: preserve-3d;
        background-color:#ffffff;
        height:540px;

        position: relative;
        z-index: 2;
    }

    .front, .back {
        -webkit-backface-visibility: hidden;
        -moz-backface-visibility: hidden;
        backface-visibility: hidden;
        visibility:visible;

        position: absolute;
        top: 0;
        left: 0;
    }

    .front {
        z-index: 2;
    }

    .back {
        -webkit-transform: rotateY(180deg);
        -moz-transform: rotateY(180deg);
        transform: rotateY(180deg);
        z-index: 200000000000000000;

    }

And here is the HTML:

<div class="card-wrapper" ontouchstart="this.classList.toggle('hover');">
                <div class="flipper">
                    <div class="front">
                        <!-- front content -->
                        <div class="card">
                            <img src="images/wakey-feature.png" alt="Wakey" width="400px" height="450px">
                            <h2 class="app-title">Wakey</h2>
                        </div>

                    </div>
                    <div class="back">
                        <!-- back content -->
                        <div class="card">
                        </div>
                    </div>
                </div>


                <div class="play-store-card">
                    <a href="https://play.google.com/store/apps/details?id=com.doublep.wakey" target="_blank">
                        <div class="dashed-line">
                            <button class="play-store-button" type="button" style="margin: 0px 0px 0px 0px;">
                                <img src="images/play-store.png">
                            </button>

                        </div>
                    </a>

                </div>
            </div>

How can I go about fixing this problem?

Answer №1

Changing the z-index won't solve the issue of making a div display in front of others.

To achieve this, you really need to bring them forward. One approach, considering you already have a translate effect on hover, is to adjust it so that the div appears closer:

Rather than

.card-wrapper:hover .flipper, .card-wrapper.hover .flipper {
       -webkit-transform: rotateY(180deg) scale(1.5,1.5) translate(10%, 10%);

it should be

.card-wrapper:hover .flipper, .card-wrapper.hover .flipper {
  -webkit-transform: rotateY(180deg) scale(1.5,1.5) translate3d(10%, 10%, -100px);

Make sure to set preserve 3d for all elements. I achieved this with:

div {
-webkit-transform-style: preserve-3d;
}

With these two adjustments, it should work correctly (in webkit).

On a side note, consider this as a prize for setting the highest z-index ever seen :-)

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

Looking for an Angular Material component that displays a list of attributes?

I am trying to create a dynamic list of properties in Angular using Material Design that adjusts for different screen sizes. For example, something similar to this design: https://i.stack.imgur.com/EUsmV.png If the screen size decreases, the labels shou ...

What is the best way to align a set of input fields with their corresponding labels, along with a single button?

https://i.sstatic.net/xSwSH.png I am facing a specific alignment challenge in my project, especially due to the presence of labels. When I group inputs and a button together and use align items center, it works perfectly. However, the labels affect the he ...

What is preventing the page from scrolling downwards?

Here's a simple question: Why can't I scroll down the page to see the rest of the content in a div that exceeds the length of the window? This has never happened to me before, and I've tried searching for solutions with no luck. I've in ...

What is the best way to create a gradual color change in each individual cell instead of changing all at once?

Looking for some help with a grid I'm working on. I've got the cells changing colors like I want them to, but they're all changing at once. What I really need is for them to light up in a specific order - Yellow, Green, Blue, White, Orange. ...

The phone number is not able to be clicked on

I have a phone number included in my markup that I would like to make clickable. Here is the code snippet: <h3 class="footer">Need assistance? Call <a href="tel:+180006XXXX">1800 06X XXX</a></h3> However, upon running this code, I ...

Refresh the options in a dropdown menu after selecting a radio button using jQuery

Upon selecting either the male or female radio button, I wish to populate a list with names corresponding to the selected gender from a database. The male and female tables in the database consist of two columns: {id} and {name}. <?php include "co ...

Incorporating a recurring image beneath a navigation menu

I'm attempting to recreate a header that has a similar appearance to the following: https://i.stack.imgur.com/uVXs3.png However, I am facing challenges in generating the repeating diamond design beneath the black bar. The diamond pattern resembles t ...

Guide to inserting a glyphicon within a bootstrap badge

I've been working on a unique way to display hierarchical data using bootstrap badges and AngularJS. My goal is to create a user-friendly experience where people can easily navigate through categories. There are 3 main types of categories: parent: T ...

Discovering the exact distance between a 'li' and a 'div' element

Currently, I am in the process of converting HTML to JSON. Here is an example of the HTML I am working with: <div class="treeprofit" id="divTreeViewIncomeDetails" style="height: auto;"> <li><span class="fa fa-folder-open highlight" ...

Transferring a selection from a dropdown menu

I am currently working on a dropdown menu where each entry has an ID and a value. The issue I am facing is that when I click on an item on the list, the click-handler is called and passes the div. While the click handler can access the id without any probl ...

What are the steps to ensure the equalizer start button functions properly?

I have created an application that mimics the functionality of an equalizer by displaying changes in audio frequencies. https://i.sstatic.net/W7Fzi.png Issues with animation arise when you click the "Start" button again. The animation resets and begins ...

What is causing the floated element to overlap the element below instead of vice versa?

div { background-color: #00FFFF; } p { width: 50px; height: 50px; border: 1px solid black; margin: 0px; } #p1 { background-color: red; float: left; } #p2 { background-color: green; } #p3 { background-color: orange; } #p4 { backgr ...

Is there a method to convert a block style/CSS to inline CSS?

Currently, I am in the process of creating an HTML/CSS email template that will be compatible with Gmail and other email clients. The issue I am facing is that Gmail does not load the <style> blocks, which means I have to resort to using inline &apos ...

Combining several position-aligned classes into a single div instead of each having their own individual div

http://jsfiddle.net/58arV/ Trying to create a question component where users can choose the correct answer out of 4 options. I planned to use 4 input styles with a checkmark "radio" DIV on the right. When a user clicks on an option, it should display a c ...

IE11 retains radio button selection even after page reload

I am facing an issue on my webpage where I have implemented radio buttons for filtering a list. ALL (default selected with checked='checked') MATCHED REST <input type="radio" value="ALL" name="options" class="radioStyle" checked autocompl ...

PHP Date Formatting: Perfecting the Date Display

I have implemented a DateTimePicker feature in my project. <div class="input-group date form_datetime"> <input type="text" size="16" readonly class="form-control"> <span class="input-group-btn"> <button class="btn btn- ...

Sending jQuery variables to PHP

Is it possible to transfer a jQuery variable to a php file? Let's take a look at the code in my_js.js: function updates() { $.getJSON("php/fetch.php", function(data) { $.each(data.result, function(){ var s_id = this[& ...

Guide on traversing to various sections within a single page with Vuetify

I attempted to use HTML anchors to achieve this: <ul> <li><a href="#dashobard">Dashboard</a></li> </ul> Here is what my target looks like: <v-card id="dashboard"> <v-card-text class="document"> Con ...

Guide on how to modify the color of a single row within a table with just a click

My table structure is as follows: <table> <tr> <td>A1</td> <td>A2</td> <td>A3</td> <td>A4</td> </tr> <tr> ...

Struggling to dynamically include an identifier to a div element within a Rails helper function

I'm currently facing a bizarre issue. Here's how my view looks: <h1>All Deals</h1> <%= sanitize print_grouped_deals(@deals) %> This is what's in my deals_helper.rb file: def print_grouped_deals(grouped_deals_by_date ...