CSS background attachment

CSS background attachment is used to define whether an image used as a background is fixed or scroll within the block.

Syntax

Output

This is the HTML paragraph inside the div. The div contains some background image. This background image has fixed attachment.


CSS background attachment values list

Sr. No.valueDescription
1fixedUsed to make background image fixed with the block.
2scrollUsed to make background image fixed with the block and will not scoll.
3localUsed to give color name. The value for this can be red, blue etc.
4transparentUsed to make a transparent color of an HTML element content. The value for this is transparent.
5initialUsed to define as the property initial value.
6inheritUsed to define the computed value of property on the elements parent.
7unsetUsed to set all the properties to their parent value if inheritable.

Reference

The CSS background specification defines in this official webpage

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.