Tuesday, October 13, 2020

FLIP CARD GAME CSS CODE

 *{

    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

body{
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(red,green,yellow);
}

img{
    width: 100px;
}

.game{
    display: flex;
    flex-wrap: wrap;
    border: 2px solid blue;
    width: 640px;
    height: 640px;
    perspective: 1000px;
}

.card{
    width: 25%;
    height: 33.33%;
    position: relative;
    border: 2px solid blueviolet;
    transform: scale(1);
    transform-style: preserve-3d;
    transition: transform .5s;
}

.card:active{
    transform: scale(0.97);
    transition: transform .2s;
}

.frontface,.backface{
    position: absolute;
    height: 100%;
    width: 100%;
    border: 2px solid olive;
    padding: 20px;
    border-radius: 5px;
    background-color: palegreen;
    backface-visibility: hidden;


}

.frontface{
    transform: rotateY(180deg);

}

/* //utility class */
.card.flip{
    transform: rotateY(180deg);
}

No comments:

Post a Comment