<?xml version="1.0" encoding="utf-8"?>

CSS background shorthand property

CSS background shorthand property Bad Practice
CSS background shorthand property Best Practice

The number of background properties is overwhelming. That's why the background shorthand property is like a magic pill allowing you to shorten your code and avoid tedious typing.

The background property allows us to set the background's color, background's image, background's repeat pattern, the background's attachment (to specify whether the background is fixed or scrolls with the page), and position in a single declaration.

If you miss any property's value, the browser will set it to default.

Improve your UX & Product skills with interactive courses that actually work