CSS

[background] CSS - background-origin 속성 - 배경이미지 좌표시작점 (= 백그라운드오리진 속성)

목차
  1. background-origin 예제 - 배경이미지 좌표시작점
  2. background-origin 정의
  3. background-origin 구문
  4. background-origin 예제 - 배경이미지 여러 개

 

background-origin 예제 - 배경이미지 좌표시작점 

 

<style>

div {margin-bottom:30px;}

  

#hz1 {

  border: 10px dashed red;

  padding: 25px;

  background: url(https://source.unsplash.com/random);

  background-repeat: no-repeat;

  background-origin: padding-box;

}


#hz2 {

  border: 10px dashed blue;

  padding: 25px;

  background: url(https://source.unsplash.com/random);

  background-repeat: no-repeat;

  background-origin: border-box;

}


#hz3 {

  border: 10px dashed tomato;

  padding: 25px;

  background: url(https://source.unsplash.com/random);

  background-repeat: no-repeat;

  background-origin: content-box;

}

</style>


<div id="hz1">

  <h2>background-origin: padding-box (기본값)</h2>

  <p>홈짱닷컴 Homzzang.com</p>

</div>


<div id="hz2"> 

  <h2>background-origin: border-box</h2>

  <p>홈짱닷컴 Homzzang.com</p>

</div>


<div id="hz3">

  <h2>background-origin: content-box</h2>

  <p>홈짱닷컴 Homzzang.com</p>  

</div>


결과보기

 

background-origin 정의

 

배경이미지 좌표시작 (= 배경 위치 영역) 지정.

 


 

1.

background-attachment:fixed 일 땐, 작동 X.

 

2.

기본값: padding-box

상속여부: X

애니효과: X

CSS버전: CSS3

JS구문: object.style.backgroundOrigin="content-box"

 

3.

IE9 이상 주요 최신 브라우저 지원.

 

 

background-origin 구문

 

selector {background-origin: padding-box|border-box|content-box|initial|inherit;}

 


[속성값]

 

padding-box 

패딩 가장자리의 왼쪽 상단에서 배경이미지 시작. (기본값)

 

border-box

테두리의 왼쪽 상단에서 배경이미지 시작.

 

content-box

내용의 왼쪽 상단에서 배경이미지 시작.

 

initial

이 속성의 기본값으로 설정.

 

inherit

부모요소의 속성값 상속.

 

 

background-origin 예제 - 배경이미지 여러 개

 

<style>

#hz1 {

  border: 10px dashed red;

  padding: 25px;

  background: url(https://i.imgur.com/YrkG5xB.gif), url(https://source.unsplash.com/random);

  background-repeat: no-repeat;

  background-origin: content-box, padding-box;

}


#hz2 {

  border: 10px dashed blue;

  padding: 25px;

  background: url(https://i.imgur.com/YrkG5xB.gif), url(https://source.unsplash.com/random);

  background-repeat: no-repeat;

  background-origin: content-box, border-box;

}


#hz3 {

  border: 10px dashed tomato;

  padding: 25px;

  background: url(https://i.imgur.com/YrkG5xB.gif), url(https://source.unsplash.com/random);

  background-repeat: no-repeat;

  background-origin: content-box, content-box;

}

</style>


<div id="hz1">

  <h2>ackground-origin: content-box, padding-box;</h2>

  <p>홈짱닷컴 Homzzang.com</p>

</div>


<div id="hz2"> 

  <h2>background-origin: content-box, border-box:</h2>

  <p>홈짱닷컴 Homzzang.com</p>

</div>


<div id="hz3">

  <h2>background-origin: content-box, content-box:</h2>

  <p>홈짱닷컴 Homzzang.com</p>  

</div>


결과보기



분류 제목
border CSS - border-image-width 속성 - 테두리 이미지 너비 (= border-image-wid…
border CSS - border-image-outset 속성 - 테두리 경계 넘는 이미지 양. (= 보더이미지아웃셋속…
border CSS - border-image-repeat 속성 - 테두리 이미지 반복할지 늘릴지 선택 (= 보더이미지리…
background CSS - background-clip 속성 - 배경영역 (= background-clip속성 = 백그라운드…
background CSS - background-origin 속성 - 배경이미지 좌표시작점 (= 백그라운드오리진 속성)
background CSS - background-size 속성 ★ - 배경이미지 크기 (background-size속성 = 백…
color CSS - RGBA , HSL , HSLA , opacity - (색상코드)
gradient CSS - Gradient (그레이디언트 = 그라디언트) 종류 - (색번짐변화=색변화) : IE 10
shadow CSS - text-shadow 속성 - 글자 그림자/음영 효과 주기 (= text-shadow속성 = 텍스…
shadow CSS - box-shadow 속성 - 요소 그림자 효과 주기 (= box-shadow속성 = 박스섀도속성)…
text CSS - text-align-last 속성 - 단락마지막라인정렬 (= text-align-last속성 = …
text CSS - text-emphasis 속성 - 텍스트 강조마크의 '모먕/색깔' 일괄 지정 (= 텍스트 글자 위…
text CSS - text-justify 속성 - 텍스트 좌우균분정렬 세부설정 (= text-justify속성 = …
text CSS - text-overflow 속성 ★ - 영역 이탈 글자 처리 (= text-overflow속성 = …
text CSS - word-break 속성 ★ - 한중일 외의 언어 (단어기준/글자기준) 줄바꿈규칙 지정 (= 줄…
10/33
목록
 홈  PC버전 로그인 일본어
그누앞단언어 1
그누뒷단언어
그외코딩언어
그누보드
제작의뢰
Q&A
커뮤니티 1
웹유틸
회원센터
홈짱닷컴 PC버전 로그인