CSS / Reference / background-repeat

개요

background-repeat는 배경 이미지의 반복 여부와 반복 방향을 정하는 속성입니다.

  • 기본값 : repeat
  • 상속 : No
  • 애니메이션 : No
  • 버전 : CSS Level 1

문법

background-repeat: repeat | repeat-x | repeat-y | no-repeat | inherit
  • repeat : 가로 방향, 세로 방향으로 반복합니다.
  • repeat-x : 가로 방향으로 반복합니다.
  • repeat-y : 세로 방향으로 반복합니다.
  • no-repeat : 반복하지 않습니다.
  • initial : 기본값으로 설정합니다.
  • inherit : 부모 요소의 속성값을 상속받습니다.

예제

  • background-repeat의 값이 repeat이면, 가로 방향과 세로 방향으로 반복합니다.
<!doctype html>
<html lang="ko">
  <head>
    <meta charset="utf-8">
    <title>CSS</title>
    <style>
      div {
        width: 100%;
        height: 600px;
        border: 1px solid #bcbcbc;
      }
      .a {
        background-image: url( "images/bg-house.png" );
        background-repeat: repeat;
      }
    </style>
  </head>
  <body>
    <div class="a">
    </div>
  </body>
</html>

  • background-repeat의 값이 repeat-x이면, 가로 방향으로 반복합니다.
background-repeat: repeat-x;

  • background-repeat의 값이 repeat-y이면, 세로 방향으로 반복합니다.
background-repeat: repeat-y;

  • background-repeat의 값이 no-repeat이면, 반복하지 않습니다.
background-repeat: no-repeat;

같은 카테고리의 다른 글
CSS / Reference / background-image

CSS / Reference / background-image

background-image는 이미지를 배경으로 사용하게 하는 속성입니다. 기본값 : none 상속 : No 애니메이션 : No 버전 : CSS Level 1

CSS / Reference / background-color

CSS / Reference / background-color

background-color로 배경의 색을 정합니다. 그 색으로 border와 padding을 포함한 영역을 칠합니다. margin 영역은 칠하지 않습니다. 기본값 : transparent 상속 : No 애니메이션 : Yes 버전 : CSS Level 1

CSS / Reference / word-break

CSS / Reference / word-break

word-break는 줄바꿈을 할 때 단어 기준으로 할 지 글자 기준으로 할 지 정하는 속성입니다. 기본값 : normal 상속 : Yes 애니메이션 : No 버전 : CSS Level 3

CSS / Reference / font-style

CSS / Reference / font-style

font-style은 글자 모양을 정하는 속성으로, 기울임 여부를 정합니다. 기본값 : normal 상속 : Yes 애니메이션 : No 버전 : CSS Level 1

CSS / Reference / background-position

CSS / Reference / background-position

background-position은 배경 이미지의 위치를 정하는 속성입니다. 기본값 : 0% 0% 상속 : No 애니메이션 : Yes 버전 : CSS Level 1

CSS / Reference / caption-side

CSS / Reference / caption-side

caption-side는 표(table)의 caption 위치를 정하는 속성입니다. 기본값 : top 상속 : Yes 애니메이션 : No 버전 : CSS Level 2

CSS / Reference / content

CSS / Reference / content

content는 선택한 요소의 앞이나 뒤에 텍스트, 이미지 등을 추가하는 속성입니다. 기본값 : normal 상속 : No 애니메이션 : No 버전 : CSS Level 2

CSS / Reference / quotes

CSS / Reference / quotes

quotes는 q 태그로 만든 인용문을 감싸는 큰따옴표를 다른 기호 또는 문자로 바꿔주는 속성입니다. 기본값 : 큰따옴표 상속 : Yes 애니메이션 : No 버전 : CSS Level 2

CSS / Reference / list-style-position

CSS / Reference / list-style-position

list-style-position으로 ul, ol 등의 목록의 마커(marker)의 위치를 정합니다. 기본값 : outside 상속 : Yes 애니메이션 : No 버전 : CSS Level 1

CSS / Reference / clip

CSS / Reference / clip

clip 속성으로 요소의 특정 부분만 나오도록 할 수 있습니다. 기본값 : auto 상속 : No 애니메이션 : Yes 버전 : CSS Level 2