How do i make background color to be green

Tell us what’s happening:

Your form element should have the background-color of green

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;
  }

  .silver-background {
    background-color: silver;
  }
   #cat-photo-element {
    background-color: green;
  }
</style>

<h2 class="red-text">CatPhotoApp</h2>
<main>
  <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
  
  <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></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"  id="cat-photo-form" background-color="green" >
    <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
    <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
    <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><br>
    <input type="text" placeholder="cat photo URL" required>
    <button type="submit">Submit</button>
  </form>
</main>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/responsive-web-design/basic-css/use-an-id-attribute-to-style-an-element/

1 Like

Hello!

Looks like there are 2 errors in your attempts. Both with you trying to style through css and with you trying to inline-style.

Let’s take a look at both!

CSS method

You did a fantastic job by declaring an id and declaring a background color!

#cat-photo-element {
    background-color: green;
  }

However! You now need to add the id to your form element. Your form only has the id:

id="cat-photo-form"

Try adding that id to your form!

Inline method

I can see that you attempted to use inline style to your form with:

background-color="green"

However, your html doesn’t know that you’re attempting to inline style. When you’re using inline style you need to specify it by using:

style="background-color:green;"

This challenge requires you to style your form with an id so I’d recommend you delete that inline styling for now.

I applaud you for seeking help! Kill this challenge, and happy coding! :sunglasses:

2 Likes

i try it but not still run. it gave me this statement,(Do not give your form any class or style attributes)

Hmm, try replacing

id="cat-photo-form"

With:

id="cat-photo-element"

Did that work? Perhaps it only wants your form to have 1 ID.