--- title: background-origin slug: Web/CSS/background-origin tags: - CSS - CSS Background - CSS Property - Reference - 'recipe:css-property' translation_of: Web/CSS/background-origin ---
CSS background-origin 속성은 배경의 원점을 테두리 시작점, 테두리 내부, 안쪽 여백 내부 중 하나로 지정합니다.
{{cssxref("background-attachment")}}가 fixed인 경우 background-origin은 무시됩니다.
/* 키워드 값 */ background-origin: border-box; background-origin: padding-box; background-origin: content-box; /* 전역 값 */ background-origin: inherit; background-origin: initial; background-origin: unset;
background-origin 속성은 다음 목록의 키워드 중 하나를 선택해 지정할 수 있습니다.
border-boxpadding-boxcontent-box{{cssinfo}}
.example {
border: 10px double;
padding: 10px;
background: url('image.jpg');
background-position: center left;
background-origin: content-box;
}
#example2 {
border: 4px solid black;
padding: 10px;
background: url('image.gif');
background-repeat: no-repeat;
background-origin: border-box;
}
div {
background-image: url('logo.jpg'), url('mainback.png'); /* Applies two images to the background */
background-position: top right, 0px 0px;
background-origin: content-box, padding-box;
}
| Specification | Status | Comment |
|---|---|---|
| {{SpecName('CSS3 Backgrounds', '#the-background-origin', 'background-origin')}} | {{Spec2('CSS3 Backgrounds')}} | Initial definition. |
{{Compat("css.properties.background-origin")}}