๐Ÿ’ปCoding/๐Ÿ“’ CSS

[css] CSS ์ด๋ฏธ์ง€ ์ž๋™ ์Šฌ๋ผ์ด๋“œ ๋งŒ๋“ค๊ธฐ : ํ˜๋Ÿฌ๊ฐ€๋Š” ์ด๋ฏธ์ง€

์Œ์€์‘ 2022. 8. 29. 11:24
728x90
๋ฐ˜์‘ํ˜•

 

CSS 
์ด๋ฏธ์ง€ ์ž๋™ ์Šฌ๋ผ์ด๋“œ ๋งŒ๋“ค๊ธฐ 
: ํ˜๋Ÿฌ๊ฐ€๋Š” ์ด๋ฏธ์ง€

 

โœ… ์ƒํ™ฉ
→ HTML๊ณผ CSS๋งŒ์œผ๋กœ ์ด๋ฏธ์ง€ ์ž๋™ ์Šฌ๋ผ์ด๋“œ ๋งŒ๋“ค๊ณ  ์‹ถ์„ ๋•Œ

 

๐ŸŸข HTML

<!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>CSS Slide Image</title>
</head>
<body>
    <div id="slider">
        <div class="image-box">
            <div><img class="" src="../images/ch_tiktok.png" alt=""></div>
            <div><img class="" src="../images/ch_facebook.png" alt=""></div>
            <div><img class="" src="../images/ch_insta.png" alt=""></div>
            <div><img class="" src="../images/ch_kakao.png" alt=""></div>
            <div><img class="" src="../images/ch_notion.png" alt=""></div>
            <div><img class="" src="../images/ch_github.png" alt=""></div>
            <div><img class="" src="../images/ch_line.png" alt=""></div>
            <div><img class="" src="../images/ch_youtube.png" alt=""></div>
            <!--   clone     -->
            <div><img class="" src="../images/ch_tiktok.png" alt=""></div>
            <div><img class="" src="../images/ch_facebook.png" alt=""></div>
            <div><img class="" src="../images/ch_insta.png" alt=""></div>
            <div><img class="" src="../images/ch_kakao.png" alt=""></div>
            <div><img class="" src="../images/ch_notion.png" alt=""></div>
            <div><img class="" src="../images/ch_github.png" alt=""></div>
            <div><img class="" src="../images/ch_line.png" alt=""></div>
            <div><img class="" src="../images/ch_youtube.png" alt=""></div>
        </div>
    </div>
</body>
</html>

 

๐ŸŸข CSS

@charset "UTF-8";

#slider {
    overflow: hidden;
    position: relative;
    /* border: 20px solid red; */
    /* // ์ด๋ฏธ์ง€ ๋ณด์—ฌ์ง€๋Š” ๋ทฐ ๋ถ€๋ถ„๋งŒํผ px์กฐ์ ˆ */
    width: 1440px;  
    height: 140px;
    box-sizing: border-box;
}
.image-box {
    /* ์›๋ณธ+ํด๋ก ์˜ ์ด ํ•ฉ */
    width:5478px;
    height:100%;
    display:flex;
    flex-wrap:nowrap;
    animation: bannermove 20s linear infinite;
}
.image-box > div {
    margin: 0px -1px 0px 0px;
}
@keyframes bannermove {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(-50%, 0);
    }
}

 

๐ŸŸข ๊ตฌํ˜„ ํŽ˜์ด์ง€

 

๐ŸŸข ์ „์ฒด ์ฝ”๋“œ

<!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>CSS Slide</title>
    <style>
    #slider {
        overflow: hidden;
        position: relative;
        /* border: 20px solid red; */
        /* // ์ด๋ฏธ์ง€ ๋ณด์—ฌ์ง€๋Š” ๋ทฐ ๋ถ€๋ถ„๋งŒํผ px์กฐ์ ˆ */
        width: 1440px;  
        height: 140px;
        box-sizing: border-box;
    }
    .image-box {
        /* ์›๋ณธ+ํด๋ก ์˜ ์ด ํ•ฉ */
        width:5478px;
        height:100%;
        display:flex;
        flex-wrap:nowrap;
        animation: bannermove 20s linear infinite;
    }
    .image-box > div {
        margin: 0px -1px 0px 0px;
    }
    @keyframes bannermove {
        0% {
            transform: translate(0, 0);
        }
        100% {
            transform: translate(-50%, 0);
        }
    }
    </style>
</head>
<body>
    <div id="slider">
        <div class="image-box">
            <div><img class="" src="../images/ch_tiktok.png" alt=""></div>
            <div><img class="" src="../images/ch_facebook.png" alt=""></div>
            <div><img class="" src="../images/ch_insta.png" alt=""></div>
            <div><img class="" src="../images/ch_kakao.png" alt=""></div>
            <div><img class="" src="../images/ch_notion.png" alt=""></div>
            <div><img class="" src="../images/ch_github.png" alt=""></div>
            <div><img class="" src="../images/ch_line.png" alt=""></div>
            <div><img class="" src="../images/ch_youtube.png" alt=""></div>
            <!--   clone     -->
            <div><img class="" src="../images/ch_tiktok.png" alt=""></div>
            <div><img class="" src="../images/ch_facebook.png" alt=""></div>
            <div><img class="" src="../images/ch_insta.png" alt=""></div>
            <div><img class="" src="../images/ch_kakao.png" alt=""></div>
            <div><img class="" src="../images/ch_notion.png" alt=""></div>
            <div><img class="" src="../images/ch_github.png" alt=""></div>
            <div><img class="" src="../images/ch_line.png" alt=""></div>
            <div><img class="" src="../images/ch_youtube.png" alt=""></div>
        </div>
    </div>
</body>
</html>

 

 

 

 

728x90
๋ฐ˜์‘ํ˜•