SyntaxStudy
Sign Up
Home CSS Reference background

background

property

Shorthand for all background properties: color, image, repeat, position, size, and more.

Syntax

background: color url() repeat position / size;

Example

css
/* Solid color */
.card { background: #f8f9fa; }

/* Gradient */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Image with fallback */
.banner {
    background: #1a1a2e url('banner.jpg') center/cover no-repeat;
    color: white;
}

/* Multiple backgrounds */
.layered {
    background:
        url('pattern.png') repeat top,
        linear-gradient(to bottom, #fff, #eee);
}