CSS3 background-origin property
Examples
Content box relative positioning of the background image:
div
{
background-image:url('smiley.gif');
background-repeat:no-repeat;
background-position:left;
background-origin:content-box;
}
{
background-image:url('smiley.gif');
background-repeat:no-repeat;
background-position:left;
background-origin:content-box;
}
try it"
Browser Support
Figures in the table represent the first browser to support the version number of the property.
属性 | |||||
---|---|---|---|---|---|
background-origin | 4.0 | 9.0 | 4.0 | 3.0 | 10.5 |
Tag definitions and instructions
background-Origin attribute specifies the background-position property should be relative positions.
Note that if background-attachment background image is "fixed", this attribute has no effect.
Defaults: | padding-box |
---|---|
inherit: | no |
version: | CSS3 |
JavaScript syntax: | object object.style.backgroundOrigin = "content-box" |
grammar
background-origin: padding-box|border-box|content-box;
值 | 描述 |
---|---|
padding-box | 背景图像填充框的相对位置 |
border-box | 背景图像边界框的相对位置 |
content-box | 背景图像的相对位置的内容框 |
related articles
CSS3 tutorial: CSS3 Backgrounds