• 회원가입
  • 로그인
  • 구글아이디로 로그인

[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>


결과보기



분류 제목
column CSS - column-span 속성 - 컬럼 병합 여부 지정 (= 컬럼병합 = 컬럼확장 = column-s…
column CSS - column-width 속성 - 컬럼 너비 지정 (= column-width속성 = 컬럼위드스속성…
column CSS - columns 속성 - (컬럼최소너비/컬럼개수) 일괄 지정 (= columns속성 = 컬럼즈속성)
box CSS - box-sizing 속성 ★★ - 너비결정방식 (= 길이결정방식 = box-sizing속성 = 박…
flex CSS - FlexBox (플렉스박스) 소개 ★★★ - 새로운 반응형 레이아웃 모델 ※ (가로/세로) (기본…
flex CSS - flex-direction 속성(C) ★★ - 기본축 방향 결정. (= flex-direction…
flex CSS - justify-content 속성(C) ★★★ - 기본축에서 아이템 정렬. (= justify-…
flex CSS - align-items 속성(C) ★★★ - 교차축에서 아이템 정렬. (= align-items속성… 2
flex CSS - flex-wrap 속성(C) ★ - 아이템 줄바꿈 가능 여부. (= flex-wrap속성 = 플렉…
flex CSS - align-content 속성(C) ★★ - 줄바꿈 된 경우, 교차축 기준으로 라인 정렬. (= …
flex CSS - flex-flow 속성(C) ☆ - (flex-direction / flex-wrap) 속성 일괄…
flex CSS - order 속성(I) - 아이템 순서 재조정 (= order속성 = 오더속성, IE11) ※ 플렉…
flex CSS - align-self 속성(I) ★ - 교차축 기준으로, 아이템 자체 정렬. (= align-sel…
responsive CSS - @media 구문 - 미디어쿼리 이용한 반응형 스타일 구현 (= media쿼리) ※ IE/Edge…
responsive CSS - RES Intro - (반응형 웹디자인 소개)
responsive CSS - Viewport ★ - 사용자에게 보이는 웹페이지 영역 (= 메타태그 뷰포트 ※ 반응형 필수조건 …
responsive CSS - RES Grid-View - (그리드뷰 = 화면너비분할 = 화면분할 = 수동그리드)
responsive CSS - Responsive Image - (반응형 이미지) ★★★
responsive CSS - RES Video - (반응형 동영상)
responsive CSS - RES Frameworks - (반응형 프레임워크) - 반응형홈페이지틀
11/25
목록
찾아주셔서 감사합니다. Since 2012