NEED HELP WITH id attribute

Tell us what’s happening:
Describe your issue in detail here.

I’ve given id attribute in form element , but it says its not correct

  **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-form {
  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://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" 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">
  <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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Safari/605.1.15

Challenge: Use an id Attribute to Style an Element

Link to the challenge:

it seems you are missing a closing bracket

No I’m not missing anything, I’ve checked sooo many times

I noticed that your css is correct other than the missing closing bracket.

All you need to do is to reset the lesson and give the green background.

then where is the closing } for the #cat-photo-form selector?

What do you mean by giving green background

The instructions say:

Try giving your form, which now has the id attribute of cat-photo-form , a ““green background.””

I just said ,that I think there is an error in the html and to start again.

I have done everything, I’m still stuck at " Your form element should have an id attribute."

<form id="cat-photo-form" action = "/submit-cat-photo">

This is wrong try changing it to:

  <form action="https://freecatphotoapp.com/submit-cat-photo" id="cat-photo-form">
1 Like

what’s your code now?

I have done this too, dosn’t work either

I have put closing bracket, still not working

1 Like

Have you tried doing your code again.

Have you passed this challenge or you still need help with it ?

The problem lies in your form element.

The error says: Your
form element should have an id attribute.

This is because you have pressed the enter key for the attributes.

<form
action="/submit-cat-photo"
id="cat-photo-form">

You have to remove the extra enter keys pressed before the action and the id attribute of the form element.

Tell us what’s happening:
Describe your issue in detail here.

  **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-form{
  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://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" 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
id="cat-photo-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>
</main>
  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Safari/605.1.15

Challenge: Use an id Attribute to Style an Element

Link to the challenge:

Hello @umeshbatalvi ,

Go and find your form opening tag. It should have an id attribute within.
For example: I will assign an id to my p element below.

<p id="paragraph"> some text here </p>

Do you still need help on this challenge??

my id attribute is within form element, it still doesn’t work

You changed the value of the action attribute.