- Home
- /
- CSS Backgrounds
CSS Tutorial
Introduction
CSS Properties
CSS Designing
CSS Advance Topics
CSS FAQs
- Home
- /
- CSS Backgrounds
CSS Backgrounds
CSS background properties allow you to decorate elements with colors, images, and even fixed scroll effects. These properties help build visually appealing layouts.
Background Color
Use background-color to fill an element’s background with a solid color.
Example:
Learn With Arshyan
Master Web Design and Development

Background Image
Use background-image to apply an image as the background of an element.
Example:

Background Repeat
Be default, background images repeat both horizontally and vertically. You can change this behavior using: repeat
, repeat-x
, repeat-y
, and no-repeat
.
Example:

Background Size
Control the size of your background image using: auto
default, cover
, contain
, and width & height values (%, px).
Example:

Background Position
Set where the background image appears inside the element using: top
, bottom
, left
, right
, center
or combination like top right
, center center
.
Example:

Background Attachment
The background-attachment property decides whether the image scrolls with the page.
scroll
(default)fixed
(remains in place)
Example:

Background Shorthand
Combine multiple background properties into one line.
Syntax:
selector {
background: [color] [attachment] [image] [repeat] [position];
}
Example:
