Setting background color in CSS
You already know how to change the text color. Now let's learn how to change the background color. This is done using the background-color
property, which takes the same values as the well-known color
.
Let's fill the block with an orange background (and make the text color white):
<div id="elem">
Lorem ipsum dolor sit amet.
</div>
#elem {
width: 300px;
height: 100px;
color: white;
background-color: orange; /* set the background color to orange */
}
:
Repeat the page according to this example:
Repeat the page according to this example: