Background Color to a Div Element

Background Color to a Div Element
0

#1

Tell us what’s happening:

The app looks correct but will not allow me to go on when i click run test. What am i doing wrong?

Your code so far

<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
  .red-text {
    color: red;
  }

  h2 {
    font-family: Lobster, Monospace;
  }

  p {
    font-size: 16px;
    font-family: Monospace;
  }

  .thick-green-border {
    border-color: green;
    border-width: 10px;
    border-style: solid;
    border-radius: 50%;
  }

  .smaller-image {
    width: 100px;
  }
   div { 
     background-color: silver;}
    
</style>

<h2 class="red-text">CatPhotoApp</h2>

<p>Click here for <a href="#">cat photos</a>.</p>

<a href="#"><img class="smaller-image thick-green-border" alt="A cute orange cat lying on its back. " src="https://bit.ly/fcc-relaxing-cat"></a>

<div class="silver:background;">
  <p>Things cats love:</p>
  <ul>
    <li>cat nip</li>
    <li>laser pointers</li>
    <li>lasagna</li>
  </ul>
  <p>Top 3 things cats hate:</p>
  <ol>
    <li>flea treatment</li>
    <li>thunder</li>
    <li>other cats</li>
  </ol>
</div>

<form action="/submit-cat-photo">
  <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
  <label><input type="radio" name="indoor-outdoor"> Outdoor</label>
  <label><input type="checkbox" name="personality" checked> Loving</label>
  <label><input type="checkbox" name="personality"> Lazy</label>
  <label><input type="checkbox" name="personality"> Energetic</label>
  <input type="text" placeholder="cat photo URL" required>
  <button type="submit">Submit</button>
</form>

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36.

Link to the challenge:


#2

If you want to add an inline style on a div. Your code should be like

<div style="background-color: silver;"></div>

or If you want to add a class with the ff style

<style>
.silver-bg {
background-color: silver;
}

</style>
<div class="silver-bg"></div>

#3

But what i have is showing as correct but it wont allow me to continue, why does that do that?
What it says to do doesn’t work


#4

My class is the same as yours except I didnt close it.
But tried that and it will allow me to go on but doesn’t show the silver bg
I am almost sure it should show a silver bg,This is crazy


#5

I think it renders the right color because of this line in your code.

div { 
     background-color: silver;
}

but this line has incorrect syntax

<div class="silver:background;">

You should put here the name of the class not the style.

The goal of the lesson is to create a class called silver-background with the background-color of silver and assign this class to your div element.

You may have been seeing the same result, but it is incorrect because it says you need to create a class that will give a silver background, not explicitly style a div with a silver background.