css 플립카드 효과

리린·2021년 9월 18일
0

css

목록 보기
1/13

강의

https://youtu.be/OV8MVmtgmoY

코드

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
        .maincontainer{
            position: relative;
            width: 250px;
            height: 320px;
 
        }
        .thecard{
            position: absolute;
            width: 100%;
            height: 100%;
            /* 이 부분을 삭제하면 이미지가 뒤집힌 것이 나온다.*/
            transform-style: preserve-3d;
            transition: all 0.5s ease;
        
        }

        .thecard:hover{
            transform: rotateY(180deg)
        }

        .thefront {
            position: absolute;
            width: 100%;
            height: 100%;
            backface-visibility: hidden;
            background: #ffc728;
            color: #333;
        }

        .theback {
            position: absolute;
            width: 100%;
            height: 100%;
            backface-visibility: hidden;
            background: #fafafa;
            color: #333;
            transform: rotateY(180deg);
        }

    </style>
  </head>
  <body>
    <div class="maincontainer">
        <div class="thecard">

    <div class="thefront">front of card</div>
    <div class="theback">back of card</div>

</div>
</div>
</body>

  </body>
</html>

profile
개발자지망생

0개의 댓글