background-color: ***;

Browser
  • IE
  • Cr
  • Sf
  • Fx
  • O

The background-color property specifies the background color of an element.


div {
background-color: #ffd78c;
}

Property Value Explanation
background-color color code or name the color of the background

The default is "transparent".

Example


<html>
<head>
<title>TAG index</title>

<style type="text/css">

div {
background-color: #85b9e9;
color: #000000;
}

.example1 {
background-color: #ffd78c;
color: #c04000;
}
.example2 {
background-color: #bde9ba;
color: #008000;
}

</style>

</head>
<body>

<div>The light blue background</div>

<p>The inline background, <span class="example1">This is the orange</span>, <span class="example2">This is the green</span>.</p>

</body>
</html>

Output
The light blue background

The inline background, This is the orange, This is the green.