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. value Description
1 fixed Used to make background image fixed with the block.
2 scroll Used to make background image fixed with the block and will not scoll.
3 local Used to give color name. The value for this can be red, blue etc.
4 transparent Used to make a transparent color of an HTML element content. The value for this is transparent.
5 initial Used to define as the property initial value.
6 inherit Used to define the computed value of property on the elements parent.
7 unset Used to set all the properties to their parent value if inheritable.

Reference

The CSS background specification defines in this official webpage

Leave a Reply

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