CSS 15 background-repeat 속성 사용하기

프론트엔드/CSS|2021. 3. 21. 13:39

 

배경 이미지

초보개발자의 성장블로그

       background-repeat : repeat-y 속성 적용됨


background-repeat : repeat-x 속성 적용됨







background-repeat : no-repeat속성 적용됨

<!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>배경 이미지</title>
    <style>
         div#a{
             width:70%;
             height:100px;
            background-image:url("https://images.pexels.com/photos/1471294/pexels-photo-1471294.jpeg?cs=srgb&dl=pexels-adi-kavazovic-1471294.jpg&fm=jpg");
            background-size:5%;
            border: 1px solid black;
            /* background-repeat:no-repeat; */
            background-repeat: repeat-y;
        }
        div#b{
            background-image:url("http://freeppt.co.kr/wp-content/uploads/2018/09/man.png");
            width:70%;
             height:auto;
            background-size:5%;
            background-repeat: repeat-x;
            border: 1px solid black;            
        }
        div#c{
            background-image:url("http://freeppt.co.kr/wp-content/uploads/2018/09/man.png");
            width:70%;
            height: 250px;
            background-repeat: no-repeat;
            border: 1px solid black;            
        }      
    </style>
</head>
<body>
    <h1>초보개발자의 성장블로그</h1>
    <div id="a">
        <h2 style="color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            background-repeat : repeat-y 속성 적용됨</h2>
    </div>
    <div id="b">
        <br><h2 style="color: black;">background-repeat : repeat-x 속성 적용됨</h2>
    </div>
    <div id="c">
        <br><br><br><br><br><br><h2 style="color: black;">background-repeat : no-repeat속성 적용됨</h2>
    </div>
</body>
</html>

댓글()
구독