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

CSS background-color property

CSS background-color property Bad Practice
CSS background-color property Best Practice

The background-color property is what web developers use to place text or elements on a colored canvas. You can set background for any HTML element, e.g., <p>, <h1>, <div>, etc.

To specify color values in CSS, we use the following formats:

• A color name, like yellow

• A HEX value, like #F8DB46

• An RGB value, like rgb(248, 219, 70)

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