๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ‘จ‍๐Ÿš€ | OTHERS/๊ฐœ๋ฐœ์ผ์ง€

HTML & CSS ํ™œ์šฉ ํ”„๋กœ์ ํŠธ_ ๊ณ ์–‘์ด ๋Œ„์Šค ์• ๋‹ˆ๋ฉ”์ด์…˜ ๋งŒ๋“ค๊ธฐ

by KASSID 2022. 1. 16.

๋ชฉ์ฐจ

    728x90

     ์ฝ”๋“œ 

     

    <div class="container">
        <div class="ground"></div>
        <div class="wall"></div>
        <div class="speaker1"></div>
        <div class="speaker2"></div>
        <div class="people"></div>
        <div class="box"></div>
    </div>

     

    *,*::after,*::after{
        box-sizing: border-box;
    }
    .container {
        width: 200px;
        height: 150px;
        border: 2px solid #000;
        animation: background 2s linear 0s infinite normal ;
        position: relative;
    }
    .ground {
        width: 196px;
        height: 45px;
        bottom: 0px;
        position: absolute;
        background: rgba(37, 37, 37, 0.884);
    }
    .wall {
        width: 190px;
        height: 130px;
        left: 5px;
        background-size: contain;
        background-repeat: no-repeat;
        position: absolute;
        background-image: url(/images/wall3.png);
    }
    .box {
        width: 50px;
        height: 50px;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%,-50%);
        background-image: url(/images/danceCat2.gif);
    }
    .speaker1 {
        width: 50px;
        height: 50px;
        position: absolute;
        transform: translate(-50%,-50%);
        top: 50%;
        left: 18%;
        background-image: url(/images/speaker.png);
        animation: speaker 1s step-end 0s infinite normal ;
    }
    .speaker2 {
        width: 50px;
        height: 50px;
        position: absolute;
        transform: translate(50%,-50%);
        top: 50%;
        right: 18%;
        background-image: url(/images/speaker.png);
        animation: speaker 1s step-end 0.5s infinite normal;
    }
    .people {
        width: 180px;
        height: 90px;
        background-size: cover;
        position: absolute;
        bottom: 0%;
        left:10px;
        background-image: url(/images/people.png);
    }
    @keyframes background {
        0%{background-color:rgb(56, 56, 56);}
        25%{background:rgb(0, 105, 65);}
        50%{background-color:rgb(56, 56, 56);}
        75%{background:rgb(43, 0, 92);}
        100%{background-color:rgb(56, 56, 56);}
    }
    @keyframes speaker {
        50%{
            top: 49%;
            height: 55px;
            width: 55px;
            background-size:cover;
        }
    }

     

     ๊ฒฐ๊ณผ 


     ์ฝ”๋ฉ˜ํŠธ 

    CSS์˜ animation์— ๋Œ€ํ•ด์„œ ์กฐ๊ธˆ ๊ณต๋ถ€ํ•ด๋ณด๊ณ  ์—ฌ๋Ÿฌ๊ฐ€์ง€ ์‹œ๋„๋ฅผ ํ•˜๋‹ค๊ฐ€

    ๊ณ ์–‘์ด ๋Œ„์Šค๋ฅผ ๋งŒ๋“ค์–ด๋ดค๋‹ค!
    ๋ชจ๋“  ๊ฒƒ๋“ค์€ ์ง์ ‘ ๋„ํŠธ๋ฅผ ํ•œ ๋•€ ํ•œ ๋•€ ์ฐ์–ด์„œ ๋งŒ๋“ค์—ˆ๋Š”๋ฐ

    ๋ณด๋žŒ๋„ ์žˆ๊ณ  ๊ฒฐ๊ณผ๊ฐ€ ๊ท€์—ฌ์›Œ์„œ ์ข‹๋‹ค!

     

     

     

     

    ๋Œ“๊ธ€