DEV Community

Timi
Timi

Posted on

Flip Card Effect CSS


<div class="maincontainer">
    <div class="thecard">
        <div class="thefront">front of card</div>
        <div class="theback">back of card</div>
    </div>
</div>
Enter fullscreen mode Exit fullscreen mode

.maincontainer {
    position: relative;
    width: 250px;
    height: 350px;
    /*background: green;*/
}
.thecard {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: all 0.5s ease;
    /*background: yellow;*/
}
.thecard:hover{
    transform: rotateY(180deg);
}

.thefront {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility:hidden;
    background: #ffc728;
    color: #333;
    /* Styling up the card */
    text-align: center;
    font-family: sans-serif;
    border-radius: 20px;
    font-size: 1.2rem;
    font-weight: bold;
}
.theback {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility:hidden;
    background: #5fcf80;
    color: #fff;
    transform: rotateY(180deg);
    /* Styling up the card */
    text-align: center;
    font-family: sans-serif;
    border-radius: 20px;
    font-size: 1.2rem;
    font-weight: bold;
}
Enter fullscreen mode Exit fullscreen mode

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more