CSS 属性:background-origin
背景定位区域 — 背景在其定位参考的元素盒子的部分。
可能的值
| 值 | 描述 | 示例 |
|---|---|---|
padding-box | 背景位置相对于 padding 区域。这是默认行为。 | |
border-box | 背景位置相对于 border 区域。 | |
content-box | 背景位置相对于 content 区域。 | |
[值], [值] | 用于多重背景。用逗号分隔的值对应于使用 background-image 分隔的多个图片。 | padding-box, content-box |
inherit | ||
initial | ||
unset | ||
示例
aside {
padding: 10px;
background-image: url("bam.png");
background-position: 0 0;
background-origin: content-box;
}
/* "bam.png" will be painted in the top-left corner of the content area, rather than the wider padding area. */
