비전공자 개발일기

Unfold CSS Effect 본문

HTML _CSS

Unfold CSS Effect

HiroDaegu 2022. 10. 27. 00:12
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>UNFOLD CSS EFFECTS</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="box">
        <span style="--i:0;"></span>
        <span style="--i:1;"></span>
        <span style="--i:2;"></span>
        <span style="--i:3;"></span>
    </div>
</body>
</html>
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.box {
    width: 640px;
    height: 360px;
    display: flex;
    transform: rotate(-25deg) skew(25deg);
    transition: .5s;
}

.box:hover {
    transform: rotate(-25deg) skew(-25deg) translateY(-20px);
}

.box span {
    width: 25%;
    height: 100%;
    background-image: url('img.jpg');
    background-size: cover;
    background-position: calc(-120px * var(--i));
    display: block;
    transition: .5s;
    pointer-events: none;
    border-top: 5px solid #FFF;
    border-bottom: 5px solid #FFF;
}

.box:hover span:nth-child(odd) {
    transform: skewY(25deg);
    box-shadow: inset 20px 0 50px rgba(0, 0, 0, .5);
}

.box:hover span:nth-child(even) {
    transform: skewY(-25deg);
    box-shadow: inset 20px 0 50px rgba(0, 0, 0, .5);
}

.box span:first-child {
    border-left: 5px solid #FFF;
}

.box span:last-child {
    border-right: 5px solid #FFF;
}
728x90
LIST

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

Credit card  (0) 2022.10.30
3D Neon Cube  (0) 2022.10.28
SOLAR Eclipse  (0) 2022.10.26
Abstract BG Generator with anime.js  (0) 2022.10.25
Light 3D Cube  (0) 2022.10.24