스타일 backgroundRepeat 속성
예시
배경 이미지를 반복 없음으로 설정합니다.
document.body.style.backgroundRepeat = "repeat-y";
아래에서 더 많은 "직접 사용해 보기" 예를 살펴보세요.
정의 및 사용
backgroundRepeat 속성은 배경 이미지를 반복(타일링)하는 방법을 설정하거나 반환합니다.
브라우저 지원
표의 숫자는 속성을 완전히 지원하는 첫 번째 브라우저 버전을 지정합니다.
Property | |||||
---|---|---|---|---|---|
backgroundRepeat | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
통사론
backgroundRepeat 속성을 반환합니다.
object.style.backgroundRepeat
backgroundRepeat 속성을 설정합니다.
object.style.backgroundRepeat = "repeat|repeat-x|repeat-y|no-repeat|initial|inherit"
속성 값
Value | Description |
---|---|
repeat | The background image is repeated both vertically and horizontally. This is default |
repeat-x | The background image is only repeated horizontally |
repeat-y | The background image is only repeated vertically |
no-repeat | The background-image is not repeated |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
기술적 세부 사항
기본값: | 반복하다 |
---|---|
반환 값: | 배경 이미지가 반복되는 방식을 나타내는 문자열 |
CSS 버전 | CSS1 |
더 많은 예
예시
지정된 DIV 요소의 backgroundRepeat 속성을 변경합니다.
document.getElementById("myDIV").style.backgroundRepeat = "repeat-x";
예시
가로 또는 세로로 반복되도록 배경 이미지를 설정합니다.
function repeatVer()
{
document.body.style.backgroundRepeat = "repeat-y";
}
function repeatHor() {
document.body.style.backgroundRepeat = "repeat-x";
}
예시
문서의 background-repeat 값을 반환합니다.
alert(document.body.style.backgroundRepeat);
관련 페이지
CSS 튜토리얼: CSS 배경
CSS 참조: background-position 속성
CSS 참조: background-repeat 속성
HTML DOM 참조: 배경 속성