Background-color

Contact Us or call 1-877-932-8228
Background-color

Background-color

The background-color property is used to specify the background color of an element. It can be applied to block elements and inline elements.

selector {
	background-color: color;
}

Code Sample:

BackgroundsAndColors/Demos/BackgroundColor.html
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Background Color</title>
</head>
<body>
<h1>Background Color</h1>

<div style="height: 100px; width: 500px; background-color: #ff0000;">
	background-color: #ff0000;
</div>

<div style="height: 100px; width: 500px; background-color: rgba(255, 0, 0, 0.5);">
	background-color: rgba(255, 0, 0, 0.5);
</div>

<div style="height: 100px; width: 500px; background-color: rgba(255, 0, 0, 0.1);">
	background-color: rgba(255, 0, 0, 0.1);
</div>

</body>
</html>

For the top element, we use a hexadecimal notation to specify the background color. For the second two elements, we use RGBA notation, with a 50% and 10% opacity, respectively:

bg color

Next