The background-color property paints a solid color behind an element's content. By default it fills the border box, under the border. Change the paint area with background-clip.
The color sits under any background-image. Transparent pixels in an image still show the color. To style the text itself, use color. Check contrast so the text stays readable.
Standard-track.
Not deprecated and not experimental. Baseline Widely available. The initial value is transparent. The property is not inherited.
A <color> can be a name (rebeccapurple), hex (#2563eb), rgb(), hsl(), and other color forms. One value only — this property does not take a comma list.
Values
Property Values
Each editor below sets only background-color (and a text color when contrast needs it).
Set the foreground first.color: #db2777 is pink on the box.
Point the fill at it.background-color: currentColor copies that computed pink.
Rescue the text. A child span uses white so the words stay readable on the pink fill.
One source of truth. Change the parent's color and the fill follows. Borders can do the same with border-color: currentColor.
Edge Cases & Pitfalls
If the fill looks wrong, one of these is usually why.
image
An opaque image covers the color
The color is always under background-image. A solid gradient or photo hides it. You only see the color through transparent parts of the image.
inherit
Not inherited by default
Children start at transparent, so a parent's blue does not pass down. Use inherit when you want that copy, or set the color again.
contrast
Low contrast fails accessibility
Light text on a light fill is hard to read. Aim for about 4.5:1 for normal text and 3:1 for large text (WCAG).
opacity
opacity fades more than the fill
opacity fades the whole element, including text and children. Prefer an alpha color when you only want a see-through background.
shorthand
The background shorthand can reset it
A later background rule that omits a color can set the fill back toward transparent. Prefer the longhand while you learn.
Compatibility
Browser Support
background-color is a browser painting property. Node.js, Deno, and Bun do not paint it.
✓ Baseline · Widely available
background-color
Chrome 1+, Firefox 1+, Safari 1+, Edge 12+, Internet Explorer 4+, Opera 3.5+. Named colors, hex, rgb, hsl, transparent, and currentColor are all widely supported in current browsers.
99%Core property support
Google Chrome1+
Full support
Mozilla Firefox1+
Full support
Apple Safari1+
Full support
Microsoft Edge12+
Full support
Opera3.5+
Full support
Samsung InternetAll modern versions
Full support
Internet Explorer4+
Full support
background-colorWidely supported
Bottom line: Safe everywhere you ship CSS. Prefer modern rgb() / hsl() with slash alpha, or 8-digit hex, in current browsers. Keep text contrast high against the fill.
Remember
Key Takeaways
Role: paint a solid fill behind content. It sits under any background image.
Default:transparent. Not inherited.
Not color: this property fills the box; color paints the text.
Accessibility: keep strong contrast between the fill and the text.
One line:background-color: #2563eb; fills the box; pair it with a contrasting color for the text.
Frequently Asked Questions
It paints a solid color behind an element's content. The color sits under any background-image. Transparent parts of an image still show the color.
transparent. No fill is painted, so the parent background can show through. The property is not inherited.
background-color fills the area behind the content. color paints the text and other foreground content. Pair them for contrast.
Yes. Use an alpha channel such as rgb(37 99 235 / 0.5), hsl(... / 50%), or an 8-digit hex like #2563eb80. That is different from opacity, which fades the whole element.
Always underneath. List images with background-image; the color is the bottom layer. If the image is opaque, you will not see the color.
It is Baseline Widely available. Chrome 1+, Firefox 1+, Safari 1+, Edge 12+, Internet Explorer 4+, and Opera 3.5+. It is a browser CSS property, not a Node.js feature.