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에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 1127 | 기타 | 7년 전 | 1851 | ||
| 1126 | 기타 | 7년 전 | 2280 | ||
| 1125 | 기타 | 7년 전 | 2089 | ||
| 1124 | 기타 | 8년 전 | 1648 | ||
| 1123 | 기타 | 8년 전 | 1493 | ||
| 1122 | 기타 | 8년 전 | 1405 | ||
| 1121 | CSS | 8년 전 | 1671 | ||
| 1120 | CSS | 8년 전 | 1636 | ||
| 1119 | CSS | 8년 전 | 1916 | ||
| 1118 | 기타 | 8년 전 | 1753 | ||
| 1117 | 기타 | 8년 전 | 1868 | ||
| 1116 | 기타 | 8년 전 | 2131 | ||
| 1115 | 기타 | 8년 전 | 2178 | ||
| 1114 | 기타 | 8년 전 | 1686 | ||
| 1113 | 기타 | 8년 전 | 1888 | ||
| 1112 | CSS | 8년 전 | 2851 | ||
| 1111 | CSS | 8년 전 | 3334 | ||
| 1110 | CSS | 8년 전 | 2234 | ||
| 1109 | CSS | 8년 전 | 2695 | ||
| 1108 | HTML | 8년 전 | 3252 | ||
| 1107 | 웹접근성 |
|
8년 전 | 2448 | |
| 1106 | CSS | 8년 전 | 2689 | ||
| 1105 | CSS | 8년 전 | 3805 | ||
| 1104 | CSS | 8년 전 | 2576 | ||
| 1103 | 반응형 | 8년 전 | 2509 | ||
| 1102 | CSS | 8년 전 | 2297 | ||
| 1101 | CSS | 8년 전 | 2301 | ||
| 1100 | HTML | 8년 전 | 3040 | ||
| 1099 | HTML | 8년 전 | 2896 | ||
| 1098 | CSS | 8년 전 | 1851 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기