The CSS background-color property sets the element’s background color. If an image is present, the color covers painted area behind the image.

Values of background-color

color: <keyword>| rgb() | rgba() | hsl() | hsla() | currentColor | transparent | hex | inherit

The initial value: transparent.

<keyword>name of the color –  case-insesitive identifiers which represents a specific color, e.g green, black, white, Crimson

rgb() – red-green-blue model (RGB) – rgb(r, g, b)- e.g.  for ‘crimson’ – rgb(220, 20, 60).

rgba() – RGBa extends the RGB color model to include the alpha channel ( the transparent canal), for crimson with opacity 0.5 – rgba(220, 20, 60, 0.5).

hsl() – hue-saturation-lightness model (HSL), for a red color: hsl(360,100%,50%).

hsla() – HSLa extends the HSL color model to include the alpha channel, for a blue color with  an opacity 0.4: hsla(240,100%,50%, 0.4).

currentColor – the keyword which allows to set the parent background color on its child.

transparent – represents a fully transparent color.

hex – RGB hex values e.g. for crimson #DC143C.



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.