Background Attachment Property
The Background Attachment property determines how the background changes when we scroll through the webpage.
Description
The Background Attachment property determines if the background scrolls with the page or remains fixed, etc. The property can take the following values:
- local - Background image scrolls with the contents of the page.
- initial - Change value to be the default value for the property (scroll)
- fixed - Background image does not scroll with the page scrolling
- scroll - Background image scrolls with the page. This value is the default value of the property.
- inherit - Background image inherits the property from it's heirarchial parent.
Syntax :
element {
background-image: url('location_to_img');
background-attachment: property_name;
}
p {
background-image: url("www.pixel.com/cool-images/coolest.jpg");
background-attachment: scroll;
}