Be Brav3

FCC Challenge 36: Give a Background Color to a Div Element

March 15, 2016

In Free Code Camp Challenge 36 we learn to set a background color to a div element.

You can set an element’s background color with the background-color property.

For example, if you wanted an element’s background color to be green, you’d put this within your style element:

[css]

.green-background {

background-color: green;

}

[/css]

Create a class called silver-background with the background-color of silver. Assign this class to your div element.

The original code is below:

[css]

CatPhotoApp

Click here for cat photos.

A cute orange cat lying on its back.

Things cats love:

  • cat nip
  • laser pointers
  • lasagna

Top 3 things cats hate:

  1. flea treatment
  2. thunder
  3. other cats
[/css]

The updated code with background color for the div element is below:

[css highlight=”27-29,38″]

CatPhotoApp

Click here for cat photos.

A cute orange cat lying on its back.

Things cats love:

  • cat nip
  • laser pointers
  • lasagna

Top 3 things cats hate:

  1. flea treatment
  2. thunder
  3. other cats
[/css]