Tutorials

CSS 'background-color' Property Explained

  • Published
  • 2 min read
  • CSS
  • HTML
  • Web Design
CSS 'background-color' Property
In this article
  1. Browser Support For 'background-color' Property
  2. CSS Syntax of the 'background-color' Property
  3. Usage of the 'background-color' Property
  4. Property Values of the 'background-color' Property

Corrected . Background painting area now qualified by background-clip (checked against MDN). The browser-support table was also rebuilt from MDN browser-compat-data. Editorial approval is still pending.

The CSS 'background-color' property sets an element's background color. By default (background-clip: border-box), the color is painted across the content and padding areas and extends underneath the border, so it shows through a transparent, semi-transparent or dashed border. The background-clip property can change that painted area, for example to stop at the padding edge. Making the color transparent affects whether the background is visible, not where it is positioned. The 'background-color' property is a fundamental aspect of web design, allowing for color customization of almost any element on a webpage.

See the Pen CSS 'background-color' Property by Webzstore (@webzstore) on CodePen.

The 'background-color' property is a versatile tool in CSS, enabling developers and designers to easily customize the appearance of elements and improve the user interface of web projects.

Browser Support For 'background-color' Property

Unprefixed support for the background-color property (selected supported implementation, desktop browsers)
BrowserVersionReleased
Chrome1Dec 2008
Edge12Jul 2015
Firefox1Nov 2004
Safari1Jun 2003
Opera3.5Nov 1998

Source: MDN browser-compat-data 8.1.4, checked 3 October 2026. Prefixed support and implementations that were later removed are not counted, and some browsers list partial support or extra values. See the MDN reference for background-color for the full compatibility details, including mobile browsers.

CSS Syntax of the 'background-color' Property

background-color: color | transparent | initial | inherit;

Usage of the 'background-color' Property

This property defines a solid color for an element's background. It's widely applied for purposes ranging from setting the color of text containers to defining hover states for interactive elements to creating colored backgrounds for sections or entire web pages. The 'background-color' property can accept any valid CSS color value, including named colors, HEX codes, RGB(a), and HSL(a) values.

Property Values of the 'background-color' Property

  • Color: Specifies the background color of the element using any valid CSS color format (e.g., #ff0000, RGB (255, 0, 0), red, etc.).
  • Transparent: Makes the background color fully transparent. This is the default value for most elements, meaning that they have no background color unless one is specified.
  • Initial: Resets the property to its default value, which is typically transparent for most elements.
  • Inherit: Inherits the 'background-color' property from the element's parent (the property is not inherited by default). This can be useful for ensuring that child elements have the same background color as their container without explicitly setting the color again.

Share this article

Written by

Webzstore Team

Webzstore has helped businesses since 2010. Today, we bring websites, digital marketing and enquiry follow-up into practical plans built around the work each business needs.

Related services

Talk about your website or marketing

Book a Free 30-Minute Call

More tutorials

All tutorials

Privacy choices

Choose what this website may load. Your choice is saved on this device for up to 180 days. Privacy Policy

Turning a choice off stops further use of that optional service on this site. It does not take back information already sent, and we cannot delete cookies that other services set in your browser.