CSS3 background-origin 속성
CSS3 background-origin 속성
CSS3 background-origin속성은 배경 이미지의 위치를 지정합니다.
이 속성에는 세 가지 값이 사용됩니다.
1. border-box - 테두리의 왼쪽 위 모퉁이에서 배경 이미지가 시작됩니다.
2. padding-box - (기본값) 배경 이미지는 패딩 가장자리의 왼쪽 위 모퉁이에서 시작합니다.
3. content-box - 배경 이미지는 콘텐츠의 왼쪽 상단에서 시작합니다.
다음 예제에서는이 background-origin속성을 보여줍니다 .
#example1 {
border: 10px solid black;
padding: 35px;
background: url(img_flwr.gif);
background-repeat: no-repeat;
background-origin: content-box;
}
<!DOCTYPE html>
<html>
<head>
<style>
#example1 {
border: 10px solid black;
padding: 35px;
background: url(img_flwr.gif);
background-repeat: no-repeat;
}
#example2 {
border: 10px solid black;
padding: 35px;
background: url(img_flwr.gif);
background-repeat: no-repeat;
background-origin: border-box;
}
#example3 {
border: 10px solid black;
padding: 35px;
background: url(img_flwr.gif);
background-repeat: no-repeat;
background-origin: content-box;
}
</style>
</head>
<body>
<p>No background-origin (padding-box is default):</p>
<div id="example1">
<h2>Lorem Ipsum Dolor</h2>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
<p>Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p>
</div>
<p>background-origin: border-box:</p>
<div id="example2">
<h2>Lorem Ipsum Dolor</h2>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
<p>Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p>
</div>
<p>background-origin: content-box:</p>
<div id="example3">
<h2>Lorem Ipsum Dolor</h2>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
<p>Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p>
</div>
</body>
</html>



게시판 목록
퍼블리셔팁
질문은 상단의 QA에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 797 | HTML | 8년 전 | 1698 | ||
| 796 | HTML | 8년 전 | 1509 | ||
| 795 | HTML | 8년 전 | 3286 | ||
| 794 | 기타 | 8년 전 | 2241 | ||
| 793 | HTML | 8년 전 | 3740 | ||
| 792 | HTML | 8년 전 | 1846 | ||
| 791 | 반응형 | 8년 전 | 2548 | ||
| 790 | HTML | 8년 전 | 10028 | ||
| 789 | HTML | 8년 전 | 5727 | ||
| 788 | CSS | 8년 전 | 2456 | ||
| 787 | 반응형 | 8년 전 | 3253 | ||
| 786 | 웹접근성 | 9년 전 | 3449 | ||
| 785 | 웹접근성 | 9년 전 | 2373 | ||
| 784 | 기타 | 9년 전 | 2375 | ||
| 783 | CSS | 9년 전 | 2230 | ||
| 782 | CSS | 9년 전 | 2405 | ||
| 781 | CSS | 9년 전 | 3940 | ||
| 780 | 반응형 | 9년 전 | 4292 | ||
| 779 | CSS | 9년 전 | 3133 | ||
| 778 | 반응형 | 9년 전 | 3271 | ||
| 777 | 반응형 | 9년 전 | 7622 | ||
| 776 | CSS | 9년 전 | 4767 | ||
| 775 | CSS | 9년 전 | 5377 | ||
| 774 | CSS | 9년 전 | 4604 | ||
| 773 | 반응형 | 9년 전 | 3591 | ||
| 772 | CSS | 9년 전 | 2979 | ||
| 771 | 웹접근성 | 9년 전 | 3518 | ||
| 770 | HTML | 9년 전 | 3725 | ||
| 769 | HTML | 9년 전 | 2366 | ||
| 768 | 9년 전 | 2382 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기