Easy Tutorial
❮ Css3 Pr Border Top Left Radius Sel Enabled ❯

CSS background-attachment Property

Example

How to specify a fixed background image:

body
{ 
    background-image:url('smiley.gif');
    background-repeat:no-repeat;
    background-attachment:fixed;
}

Tag Definition and Usage

The background-attachment property sets whether a background image is fixed or scrolls with the rest of the page.

Default value: scroll
Inherited: no
--- ---
Version: CSS1
--- ---
JavaScript syntax: object.style.backgroundAttachment="fixed"
--- ---

Browser Support

The numbers in the table specify the first browser version that fully supports the property.

The numbers preceding -webkit-, -ms-, or -moz- indicate the first browser version that supports the prefixed property.

Property
background-attachment 1.0 4.0 1.0 1.0 3.5

Note: Internet Explorer 8 and earlier versions do not support multiple background images on one element.


Property Values

Value Description
scroll The background image scrolls with the page. This is default.
fixed The background image does not scroll with the page.
local The background image scrolls with the element's contents.
initial Sets this property to its default value. Read about initial
inherit Specifies that the value of the background-attachment property should be inherited from the parent element. Read about inherit

Related Articles

CSS Tutorial: CSS Background

❮ Css3 Pr Border Top Left Radius Sel Enabled ❯