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에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 737 | CSS |
kiplayer
|
11년 전 | 16460 | |
| 736 | HTML |
|
11년 전 | 7106 | |
| 735 | CSS |
잘살아보자
|
11년 전 | 5799 | |
| 734 | CSS |
잘살아보자
|
11년 전 | 4531 | |
| 733 | CSS |
잘살아보자
|
11년 전 | 6787 | |
| 732 | HTML |
잘살아보자
|
11년 전 | 4722 | |
| 731 | CSS |
잘살아보자
|
11년 전 | 9441 | |
| 730 | 기타 |
잘살아보자
|
11년 전 | 3490 | |
| 729 | HTML |
잘살아보자
|
11년 전 | 7656 | |
| 728 | 기타 |
|
11년 전 | 6812 | |
| 727 | 기타 | 11년 전 | 11480 | ||
| 726 | 기타 |
|
11년 전 | 5480 | |
| 725 | 기타 |
네이비칼라
|
11년 전 | 4385 | |
| 724 | CSS |
잘살아보자
|
11년 전 | 4904 | |
| 723 | CSS |
잘살아보자
|
11년 전 | 6612 | |
| 722 | CSS |
잘살아보자
|
11년 전 | 17080 | |
| 721 | CSS |
|
11년 전 | 7171 | |
| 720 | 기타 | 11년 전 | 3769 | ||
| 719 | 기타 | 12년 전 | 7330 | ||
| 718 | CSS | 12년 전 | 10527 | ||
| 717 | 반응형 | 12년 전 | 6140 | ||
| 716 | 반응형 | 12년 전 | 14563 | ||
| 715 | 기타 | 12년 전 | 7323 | ||
| 714 | CSS | 12년 전 | 5047 | ||
| 713 | 반응형 | 12년 전 | 30123 | ||
| 712 | 기타 | 12년 전 | 5282 | ||
| 711 | HTML |
kiplayer
|
12년 전 | 10885 | |
| 710 | CSS | 12년 전 | 15292 | ||
| 709 | 웹접근성 | 12년 전 | 6742 | ||
| 708 | 웹접근성 | 12년 전 | 6061 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기