Javatpoint Logo
Javatpoint Logo

CSS Background-color

This property is used to set the background color of an element. The background of an element covers the total size, including the padding and border and excluding margin. It can be applied to all HTML elements.

Syntax

Let's discuss the possible values of this property.

  • color_name: It is used for defining the background color value or the color codes. It can be given by using the color name, hexadecimal value, or rgb() value.
  • transparent: It is the default value of this property, which is used to specify the transparent background-color.
  • initial: It is not used to set the background color. It sets the default value.
  • Inherit: It is used to inherit the background-color from its parent.

Let's see an illustration of this property.

Example

Test it Now

Next TopicCSS Line Height




Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA