비전공자 개발일기

X-mas Background 본문

HTML _CSS

X-mas Background

HiroDaegu 2022. 12. 26. 00:48
728x90
SMALL

happy chirstmas

 

움직이는 눈, 산타
<!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>X-Mas BG</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="container">
        <div class="circle"></div>
        <div class="snow">
            <span style="--i: 11;"></span>
            <span style="--i: 22;"></span>
            <span style="--i: 24;"></span>
            <span style="--i: 10;"></span>
            <span style="--i: 14;"></span>
            <span style="--i: 23;"></span>
            <span style="--i: 18;"></span>
            <span style="--i: 16;"></span>
            <span style="--i: 19;"></span>
            <span style="--i: 20;"></span>
            <span style="--i: 22;"></span>
            <span style="--i: 25;"></span>
            <span style="--i: 18;"></span>
            <span style="--i: 21;"></span>
            <span style="--i: 13;"></span>
            <span style="--i: 15;"></span>
            <span style="--i: 26;"></span>
            <span style="--i: 17;"></span>
            <span style="--i: 13;"></span>
            <span style="--i: 28;"></span>
            <span style="--i: 11;"></span>
            <span style="--i: 22;"></span>
            <span style="--i: 24;"></span>
            <span style="--i: 10;"></span>
            <span style="--i: 14;"></span>
            <span style="--i: 23;"></span>
            <span style="--i: 18;"></span>
            <span style="--i: 16;"></span>
            <span style="--i: 19;"></span>
            <span style="--i: 20;"></span>
            <span style="--i: 22;"></span>
            <span style="--i: 25;"></span>
            <span style="--i: 18;"></span>
            <span style="--i: 21;"></span>
            <span style="--i: 13;"></span>
            <span style="--i: 15;"></span>
            <span style="--i: 26;"></span>
            <span style="--i: 17;"></span>
            <span style="--i: 13;"></span>
            <span style="--i: 28;"></span>  
        </div>
    </div>
</body>
</html>
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    position: relative;
}

body {
    background: linear-gradient(#A2000A, #CF0000);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.container::before {
    content: '';
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 200px;
    background-image: url('tree.png');
    z-index: 1;
}

.container .circle {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 350px;
    height: 350px;
    background-color: #FFF;
    border-radius: 50%;
}

.container .circle::before {
    content: '';
    position: absolute;
    inset: -200px -300px;
    background-image: url('santa.png');
    background-position: center;
    background-repeat: no-repeat;
    background-size: 600px;
    animation: animate 5s ease-in-out infinite;
}

@keyframes animate {
    0%, 100% {
        transform: translateY(-25px);
    }
    50% {
        transform: translateY(25px);
    }
}

.container .circle::after {
    content: 'Happy Christmas';
    position: absolute;
    inset: -125px -200px;
    font-size: 4em;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    color: #FFF;
}

.container .snow {
    display: flex;
}

.container .snow span {
    min-width: 5px;
    height: 5px;
    background-color: #FFF;
    border-radius: 50%;
    margin: 0 1vw;
    box-shadow: -100px 20px 5px #FFF, 100px 20px 10px #FFF;
    animation: animate2 15s linear infinite;
    animation-duration: calc(75s / var(--i));
}

.container .snow span:nth-child(2n) {
    min-width: 10px;
    height: 10px;
}

@keyframes animate2 {
    0% {
        transform: translateY(-10vh);
    }
    100% {
        transform: translateY(100vh);
    }
}
728x90
LIST

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

Starbucks Landing Page  (0) 2023.01.02
Happy New Year 2023  (0) 2022.12.31
Number Fill Animation  (0) 2022.12.22
Noisy Grainy Icons  (0) 2022.12.21
Credit Card2  (0) 2022.12.19