Tuesday, October 13, 2020

FLIP CARD GAME CSS CODE

 *{

    padding0;
    margin0;
    box-sizingborder-box;
}

body{
    height100vh;
    displayflex;
    justify-contentcenter;
    align-itemscenter;
    backgroundlinear-gradient(red,green,yellow);
}

img{
    width100px;
}

.game{
    displayflex;
    flex-wrapwrap;
    border2px solid blue;
    width640px;
    height640px;
    perspective1000px;
}

.card{
    width25%;
    height33.33%;
    positionrelative;
    border2px solid blueviolet;
    transformscale(1);
    transform-stylepreserve-3d;
    transition: transform .5s;
}

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

.frontface,.backface{
    positionabsolute;
    height100%;
    width100%;
    border2px solid olive;
    padding20px;
    border-radius5px;
    background-colorpalegreen;
    backface-visibilityhidden;


}

.frontface{
    transformrotateY(180deg);

}

/* //utility class */
.card.flip{
    transformrotateY(180deg);
}

No comments:

Post a Comment