CSS background-attachment property
Examples
How to specify a fixed background image:
body
{
background-image:url('smiley.gif');
background-repeat:no-repeat;
background-attachment:fixed;
}
{
background-image:url('smiley.gif');
background-repeat:no-repeat;
background-attachment:fixed;
}
try it"
Tag definitions and instructions
background-attachment background image is fixed or not, or with the rest of the page scrolling.
Defaults: | scroll |
---|---|
inherit: | no |
version: | CSS1 |
JavaScript syntax: | object object.style.backgroundAttachment = "fixed" |
Browser Support
Figures in the table represent the first browser to support the version number of the property.
Immediately following the digital -webkit-, -ms- or -moz- ago in support of the prefix attribute first browser version number.
属性 | |||||
---|---|---|---|---|---|
background-attachment | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
Property Value
value | Explanation |
---|---|
scroll | Background image scroll with the rest of the page. This is the default |
fixed | The background image is fixed |
inherit | Specifies the background-attachment settings should be inherited from the parent element |
related articles
CSS tutorial: CSS Background