If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

CSS: The background-color property

The background-color property changes the background color of the element. All elements default to a transparent background. Colors can be specified in several ways:
nameEvery browser knows 16 common color names.red
rgb()A triplet of values from 0 to 255, representing the Red-Green-Blue color spectrum.rgb(255, 0, 0)
rgba()Like rgb(), but with a fourth value representing the opacity, ranging from 0 to 1.rgba(255, 0, 0, 0)
hexA hexadecimal number representing the R-G-B triplet.#FF0000

Want to join the conversation?

No posts yet.