비전공자 개발일기

3D Flip Product Card 본문

HTML _CSS

3D Flip Product Card

HiroDaegu 2022. 12. 5. 00:29
728x90
SMALL

<!DOCTYPE html>
<html lang="ko">
<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>3D Flip Product Card</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="card">
        <div class="cover">
            <img src="img2.png" alt="시계">
        </div>
        <div class="details">
            <div>
                <img src="img1.png" alt="시계" style="height: 200px;">
                <h3>New Apple Watch</h3>
                <h2><sup>$</sup>500</h2>
                <a href="#">Buy Now</a>
            </div>
        </div>
    </div>
</body>
</html>
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    position: relative;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #09383E;
}

.card {
    width: 300px;
    height: 400px;
    background-color: #FFF;
    transform-style: preserve-3d;
    transform: perspective(2000px);
    transition: 1s;
    box-shadow: inset 300px 0 50px rgba(0, 0, 0, .15), 0 20px 20px rgba(0, 0, 0, .15);
}

.card:hover {
    transform: perspective(2000px) translateX(50%);
    box-shadow: inset 20px 0 50px rgba(0, 0, 0, .15), 0 10px 10px rgba(0, 0, 0, .15);

}

.card .cover {
    width: 100%;
    height: 100%;
    background-color: #FFF;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    transform-style: preserve-3d;
    overflow: hidden;
    transition: 1s ease-in-out;
    transform-origin: left;
}

.card:hover .cover {
    transform: rotateY(-180deg);
}

.card .cover img {
    max-width: 100%;
    height: 100%;
    transform: rotate(80deg);
}

.card .cover::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 150%;
    background-color: #FFF;
    transform: rotate(36.5deg);
    box-shadow: 0 0 0 20px #47BFCE;
    transition: .5s;
    transition-delay: 1s;
}

.card:hover .cover::before {
    width: 0;
    box-shadow: 0 0 0 250px #47BFCE;
    transform: rotate(143.5deg);
}

.card .details {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    text-align: center;
    z-index: 1;
}

.card .details h3 {
    font-weight: 500;
    margin: 5px 0;
}

.card .details h2 {
    font-size: 1.5em;
    font-weight: 500;
    color: #E82A5B;
}

.card .details a {
    display: inline-block;
    margin-top: 5px;
    padding: 8px 20px;
    background-color: #47BFCE;
    color: #FFF;
    letter-spacing: 1px;
    border-radius: 25px;
    font-weight: 500;
    text-decoration: none;
}
728x90
LIST

'HTML _CSS' 카테고리의 다른 글

Create Hover Effect  (0) 2022.12.12
Infinite Ticker  (0) 2022.12.10
CSS Tricky Shape  (0) 2022.12.03
Input Label Animation  (0) 2022.11.28
Aspect Ratio Calculator  (0) 2022.11.27