Background Color

In this lesson, we have only been setting the foreground color using color. We can also set the background color using background-color. We can use any color model that we have learned, including transparency (RGB, RGBA, Hexadecimal, HSL, HSLA).

For example:

p {
	background-color: #00000080;
}

This will set the background color of paragraphs to 50% transparent black.

Instructions

Change the background color of the main element to #00000010. It is a black color that is approximately 94% transparent, so it will darken the white background.

Start programming for free

By signing up, you agree to the Terms of Service and Privacy Policy.

Or sign up with:

7/8