# Https://learn.freecodecamp.org/responsive-web-design/basic-css/use-an-id-attribute-to-style-an-element

**URL:** <https://forum.freecodecamp.org/t/https-learn-freecodecamp-org-responsive-web-design-basic-css-use-an-id-attribute-to-style-an-element/244955>\
**Category:** Curriculum Help\
**Tags:** css, html\
**Created:** [December 10, 2018, 10:24pm UTC](https://forum.freecodecamp.org/t/https-learn-freecodecamp-org-responsive-web-design-basic-css-use-an-id-attribute-to-style-an-element/244955 "2018-12-10T22:24:58Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![israash](https://avatars.discourse-cdn.com/v4/letter/i/c89c15/32.png) [@israash](https://forum.freecodecamp.org/u/israash)\
**Post date:** [December 10, 2018, 10:24pm UTC](https://forum.freecodecamp.org/t/https-learn-freecodecamp-org-responsive-web-design-basic-css-use-an-id-attribute-to-style-an-element/244955/1 "2018-12-10T22:24:58Z")

</div>

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/responsive-web-design/basic-css/use-an-id-attribute-to-style-an-element)**
>
> Learn to Code — For Free

I tried to solve this problem but I can’t  
I made everything mentioned in the description but it didn’t work, I watch the video too  
anyone can help me solve this

---

<div class="post-metadata">

**Author:** ![Sunithack1](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/sunithack1/32/17449_2.png) [@Sunithack1](https://forum.freecodecamp.org/u/Sunithack1)\
**Post date:** [December 10, 2018, 10:37pm UTC](https://forum.freecodecamp.org/t/https-learn-freecodecamp-org-responsive-web-design-basic-css-use-an-id-attribute-to-style-an-element/244955/2 "2018-12-10T22:37:33Z")

</div>

Hi,

Could you share the code that you wrote for this exercise?

---

<div class="post-metadata">

**Author:** ![israash](https://avatars.discourse-cdn.com/v4/letter/i/c89c15/32.png) [@israash](https://forum.freecodecamp.org/u/israash)\
**Post date:** [December 10, 2018, 10:39pm UTC](https://forum.freecodecamp.org/t/https-learn-freecodecamp-org-responsive-web-design-basic-css-use-an-id-attribute-to-style-an-element/244955/3 "2018-12-10T22:39:42Z")

</div>

yes, sure  
here’s the code:-

\<link href=“[https://fonts.googleapis.com/css?family=Lobster](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://bit.ly/fcc-relaxing-cat](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”\>

\<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\>

---

<div class="post-metadata">

**Author:** ![Sunithack1](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/sunithack1/32/17449_2.png) [@Sunithack1](https://forum.freecodecamp.org/u/Sunithack1)\
**Post date:** [December 10, 2018, 10:49pm UTC](https://forum.freecodecamp.org/t/https-learn-freecodecamp-org-responsive-web-design-basic-css-use-an-id-attribute-to-style-an-element/244955/4 "2018-12-10T22:49:36Z")

</div>

Thanks! Your solution looks good to me. What kind of error message are you receiving?

---

<div class="post-metadata">

**Author:** ![israash](https://avatars.discourse-cdn.com/v4/letter/i/c89c15/32.png) [@israash](https://forum.freecodecamp.org/u/israash)\
**Post date:** [December 10, 2018, 10:53pm UTC](https://forum.freecodecamp.org/t/https-learn-freecodecamp-org-responsive-web-design-basic-css-use-an-id-attribute-to-style-an-element/244955/5 "2018-12-10T22:53:51Z")

</div>

Your form element should have the background-color of green.

this is the error message!

---

<div class="post-metadata">

**Author:** ![Sunithack1](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/sunithack1/32/17449_2.png) [@Sunithack1](https://forum.freecodecamp.org/u/Sunithack1)\
**Post date:** [December 10, 2018, 11:08pm UTC](https://forum.freecodecamp.org/t/https-learn-freecodecamp-org-responsive-web-design-basic-css-use-an-id-attribute-to-style-an-element/244955/6 "2018-12-10T23:08:55Z")

</div>

Okay. Could you reset the exercise and try your solution once again?

---

<div class="post-metadata">

**Author:** ![israash](https://avatars.discourse-cdn.com/v4/letter/i/c89c15/32.png) [@israash](https://forum.freecodecamp.org/u/israash)\
**Post date:** [December 10, 2018, 11:11pm UTC](https://forum.freecodecamp.org/t/https-learn-freecodecamp-org-responsive-web-design-basic-css-use-an-id-attribute-to-style-an-element/244955/7 "2018-12-10T23:11:23Z")

</div>

I tried this many times and it didn’t work  
I’ll search about this problem again

thank you so much for your response.

---

<div class="post-metadata">

**Author:** ![Tirjasdyn](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/tirjasdyn/32/158733_2.png) [@Tirjasdyn](https://forum.freecodecamp.org/u/Tirjasdyn)\
**Post date:** [December 10, 2018, 11:21pm UTC](https://forum.freecodecamp.org/t/https-learn-freecodecamp-org-responsive-web-design-basic-css-use-an-id-attribute-to-style-an-element/244955/8 "2018-12-10T23:21:37Z")

</div>

Make sure you are using chrome. Other browsers may not work.

---

<div class="post-metadata">

**Author:** ![israash](https://avatars.discourse-cdn.com/v4/letter/i/c89c15/32.png) [@israash](https://forum.freecodecamp.org/u/israash)\
**Post date:** [December 10, 2018, 11:24pm UTC](https://forum.freecodecamp.org/t/https-learn-freecodecamp-org-responsive-web-design-basic-css-use-an-id-attribute-to-style-an-element/244955/9 "2018-12-10T23:24:45Z")

</div>

I am using chrome canary! its for developers

ok thank you

---

<div class="post-metadata">

**Author:** ![jel111](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jel111/32/158781_2.png) [@jel111](https://forum.freecodecamp.org/u/jel111)\
**Post date:** [December 11, 2018, 1:42am UTC](https://forum.freecodecamp.org/t/https-learn-freecodecamp-org-responsive-web-design-basic-css-use-an-id-attribute-to-style-an-element/244955/10 "2018-12-11T01:42:41Z")

</div>

Canary is the daily build trying out there new stuff, not a stable release and could cause issues? I’m on a Mac, I stay away from Chrome as much as possible.

---

<div class="post-metadata">

**Author:** ![jchhun](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jchhun/32/106238_2.png) [@jchhun](https://forum.freecodecamp.org/u/jchhun)\
**Post date:** [December 11, 2018, 2:01am UTC](https://forum.freecodecamp.org/t/https-learn-freecodecamp-org-responsive-web-design-basic-css-use-an-id-attribute-to-style-an-element/244955/11 "2018-12-11T02:01:10Z")

</div>

{“index.html”:"\<link href=“https://fonts.googleapis.com/css?family=Lobster” rel=“stylesheet” type=“text/css”\>\n\n .red-text {\n color: red;\n }\n\n h2 {\n font-family: Lobster, monospace;\n }\n\n p {\n font-size: 16px;\n font-family: monospace;\n }\n\n .thick-green-border {\n border-color: green;\n border-width: 10px;\n border-style: solid;\n border-radius: 50%;\n }\n\n .smaller-image {\n width: 100px;\n }\n\n .silver-background {\n background-color: silver;\n }\n form{\n background-color:green;\n }\n\n\n\<h2 class=“red-text”\>CatPhotoApp\n\n \<p class=“red-text”\>Click here to view more \<a href="#"\>cat photos.

\n \n \<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.”\>\n \n \<div class=“silver-background”\>\n 

Things cats love:

\n 
\n - cat nip
\n - laser pointers
\n - lasagna
\n 
\n 

Top 3 things cats hate:

\n 
\n 1. flea treatment
\n 2. thunder
\n 3. other cats
\n 
\n \n \n \<form action="/submit-cat-photo" id=“cat-photo-form”\>\n \<input type=“radio” name=“indoor-outdoor” checked\> Indoor\n \<input type=“radio” name=“indoor-outdoor”\> Outdoor  
\n \<input type=“checkbox” name=“personality” checked\> Loving\n \<input type=“checkbox” name=“personality”\> Lazy\n \<input type=“checkbox” name=“personality”\> Energetic  
\n \<input type=“text” placeholder=“cat photo URL” required\>\n \<button type=“submit”\>Submit\n \n"}

---

<div class="post-metadata">

**Author:** ![jchhun](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jchhun/32/106238_2.png) [@jchhun](https://forum.freecodecamp.org/u/jchhun)\
**Post date:** [December 11, 2018, 2:02am UTC](https://forum.freecodecamp.org/t/https-learn-freecodecamp-org-responsive-web-design-basic-css-use-an-id-attribute-to-style-an-element/244955/12 "2018-12-11T02:02:28Z")

</div>

are you trying to color the form element background color green?  
i clicked the link above and that where it lead me

---

<div class="post-metadata">

**Author:** ![jchhun](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jchhun/32/106238_2.png) [@jchhun](https://forum.freecodecamp.org/u/jchhun)\
**Post date:** [December 11, 2018, 2:05am UTC](https://forum.freecodecamp.org/t/https-learn-freecodecamp-org-responsive-web-design-basic-css-use-an-id-attribute-to-style-an-element/244955/13 "2018-12-11T02:05:39Z")

</div>

> [@israash](#):
>
> #cat-photo-form {
> 
> background-color: green;

instead of #cat-photo-form  
i believe your’e looking to make the

form  
{  
background-color:green;  
}

---

<div class="post-metadata">

**Author:** ![Tirjasdyn](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/tirjasdyn/32/158733_2.png) [@Tirjasdyn](https://forum.freecodecamp.org/u/Tirjasdyn)\
**Post date:** [December 11, 2018, 3:52pm UTC](https://forum.freecodecamp.org/t/https-learn-freecodecamp-org-responsive-web-design-basic-css-use-an-id-attribute-to-style-an-element/244955/14 "2018-12-11T15:52:55Z")

</div>

I would use a more stable version of chrome. Canary is not good for production.

---

<div class="post-metadata">

**Author:** ![lasjorg](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/lasjorg/32/280761_2.png) [@lasjorg](https://forum.freecodecamp.org/u/lasjorg)\
**Post date:** [December 11, 2018, 6:38pm UTC](https://forum.freecodecamp.org/t/https-learn-freecodecamp-org-responsive-web-design-basic-css-use-an-id-attribute-to-style-an-element/244955/15 "2018-12-11T18:38:14Z")

</div>

The test does pass in canary for me, just FYI. But i would agree that the stable branch is probably a safer choice.

Can you try running the test in [Incognito mode](https://support.google.com/chrome/answer/95464).

---

<div class="post-metadata">

**Author:** ![israash](https://avatars.discourse-cdn.com/v4/letter/i/c89c15/32.png) [@israash](https://forum.freecodecamp.org/u/israash)\
**Post date:** [December 11, 2018, 9:56pm UTC](https://forum.freecodecamp.org/t/https-learn-freecodecamp-org-responsive-web-design-basic-css-use-an-id-attribute-to-style-an-element/244955/16 "2018-12-11T21:56:26Z")

</div>

yes I’m trying to do this

---

<div class="post-metadata">

**Author:** ![israash](https://avatars.discourse-cdn.com/v4/letter/i/c89c15/32.png) [@israash](https://forum.freecodecamp.org/u/israash)\
**Post date:** [December 11, 2018, 9:57pm UTC](https://forum.freecodecamp.org/t/https-learn-freecodecamp-org-responsive-web-design-basic-css-use-an-id-attribute-to-style-an-element/244955/17 "2018-12-11T21:57:48Z")

</div>

No,  
I am making the style for the class cat-photo-form not (form) !

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [March 9, 2021, 11:08am UTC](https://forum.freecodecamp.org/t/https-learn-freecodecamp-org-responsive-web-design-basic-css-use-an-id-attribute-to-style-an-element/244955/18 "2021-03-09T11:08:25Z")

</div>

Closed on March 9, 2021, 11:08am UTC


