English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
CSS background-The origin attribute specifies the positioning area of the background, that is, usingbackground-imageThe position of the image origin specified by the attribute.
The following table summarizes the usage context and version history of this attribute.
Default value: | padding-box |
---|---|
Applicable to: | All elements. It also applies to::first-letterand::first-line. |
Inheritance: | None |
Animated production: | 否。No. Please see. |
Animation properties | CSS3version: |
new feature | JavaScript syntax: object-object.style.backgroundOrigin="content |
The syntax of origin
background-The syntax of this attribute is as follows:-origin: border-box | padding-box | content
box | initial | inherit-The following example demonstrates how to use background
Example .box { 25height: width: 15height: 0px; 10padding: px; 6border:333px dashed # ;/background: url("images-sky.jpg") no background-repeat; background-size: contain;-origin: content box;}/Test and see‹
›Note:-origin if the value attribute is ignoredbackground-attachmentThe attribute is specified as fixed.
The following table describes the values of this attribute.
Value | Description |
---|---|
border-box | Specify that the background extends to the outer edge of the border. The background is drawn below the border. |
padding-box | Specify that the background extends to the outer edge of the padding. The background is not drawn below the border. This is the default value. |
content-box | Specify that the background is drawn only within the content box (clipped to). The background is not drawn below the border and padding area. |
initial | Set this attribute to its default value. |
inherit | If specified, the associated element adopts its parent element's background-The calculated value of the origin attribute. |
background-Browser compatibility, the origin attribute is supported by all mainstream browsers.
|
Please refer to the following tutorials:CSS3Background,CSS3Background.
Related attributes:background,background-attachment,background-color,background-image,background-clip,background-position,background-repeat,background-size.