background-attachment property
body
{
background-image:url('smiley.gif');
background-repeat:no-repeat;
background-attachment:fixed;
}
Label definition and usage instructions
Background-Attachment: Specifies whether the background image remains fixed or scrolls along with the rest of the page.
| Default value: | scroll |
|---|
| Inheritance: | no |
| Version: | CSS1 |
| JavaScript syntax: | object object.style.backgroundAttachment="fixed" |
attribute value
| 值 | Description |
|---|
| scroll | The background image scrolls along with the page as it scrolls – this is the default setting. |
| fixed | The background image does not scroll along with the page as it scrolls. |
| local | The background image scrolls along with the content as it scrolls. |
| initial | Sets the default value for this property. Read about initial |
| inherit | The `background-attachment` property should be inherited from the parent element. |