CSS Background
CSS
CSS Backgrounds
The CSS background properties are used to style the background of elements like color, images, repeat behavior, position, and size.
1. background-color
- Sets the background color of an element.
 
2. background-image
- Sets an image as the background.
 
3. background-repeat
- Controls if/how the background image repeats.
 
4. background-position
- Sets the starting position of the background image.
 
5. background-size
- Controls the size of the background image.
 
6. background-attachment
- Specifies whether the background scrolls with the page or stays fixed.
 
7. Background (Shorthand)
- You can combine all background properties into a single line:
 
This includes:
- image
 - repeat
 - position
 - size (after /)
 - background color