# Challenge Use CSS Selectors to Style Elements

**URL:** <https://forum.freecodecamp.org/t/challenge-use-css-selectors-to-style-elements/77067>\
**Category:** General\
**Created:** [January 16, 2017, 5:04am UTC](https://forum.freecodecamp.org/t/challenge-use-css-selectors-to-style-elements/77067 "2017-01-16T05:04:23Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![gotbassoon](https://avatars.discourse-cdn.com/v4/letter/g/0ea827/32.png) [@gotbassoon](https://forum.freecodecamp.org/u/gotbassoon)\
**Post date:** [January 16, 2017, 5:04am UTC](https://forum.freecodecamp.org/t/challenge-use-css-selectors-to-style-elements/77067/1 "2017-01-16T05:04:23Z")

</div>

Hello there. I am having an issue with this challenge. The challenge is create a CSS style element. Add the necessary CSS to turn all h2 elements blue.

```auto
<style>
h2 {color: blue;}
</style> 

<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>

```

That is the code I use and I get an error that my h2 element is not blue. I don’t understand why I’m getting this error. Can anyone explain?

---

<div class="post-metadata">

**Author:** ![timotheap](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/timotheap/32/26039_2.png) [@timotheap](https://forum.freecodecamp.org/u/timotheap)\
**Post date:** [January 16, 2017, 5:17am UTC](https://forum.freecodecamp.org/t/challenge-use-css-selectors-to-style-elements/77067/2 "2017-01-16T05:17:27Z")

</div>

Did you remove the inline style and write a **separate** `<style></style>` where you can target h2 and give it a color: blue?  
so

```auto
   h2{
       color: blue;
      }
   </style>

```

---

<div class="post-metadata">

**Author:** ![kevcomedia](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kevcomedia/32/125737_2.png) [@kevcomedia](https://forum.freecodecamp.org/u/kevcomedia)\
**Post date:** [January 16, 2017, 5:25am UTC](https://forum.freecodecamp.org/t/challenge-use-css-selectors-to-style-elements/77067/3 "2017-01-16T05:25:31Z")

</div>

I cleaned up your code.  
You need to use triple backticks to post code to the forum.  
See [this post for details](http://forum.freecodecamp.com/t/forum-code-formatting/25574).

I think you deleted the entire `<h2>` element. You’re only supposed to delete the inline style in that `<h2>`.

---

<div class="post-metadata">

**Author:** ![gotbassoon](https://avatars.discourse-cdn.com/v4/letter/g/0ea827/32.png) [@gotbassoon](https://forum.freecodecamp.org/u/gotbassoon)\
**Post date:** [January 16, 2017, 5:32am UTC](https://forum.freecodecamp.org/t/challenge-use-css-selectors-to-style-elements/77067/4 "2017-01-16T05:32:28Z")

</div>

Thanks so much for your replies! The link and explanation were helpful. I think it’s a glitch, because when I put the code in here the color shows blue. Thanks again!

---

<div class="post-metadata">

**Author:** ![abs73129](https://avatars.discourse-cdn.com/v4/letter/a/ce73a5/32.png) [@abs73129](https://forum.freecodecamp.org/u/abs73129)\
**Post date:** [February 9, 2017, 3:41pm UTC](https://forum.freecodecamp.org/t/challenge-use-css-selectors-to-style-elements/77067/5 "2017-02-09T15:41:03Z")

</div>

I’m starting the basic css and I’m having the same problems withh changing text color. it changes on the phone but the code is not accepted when i run test. did it ever work for you?

---

<div class="post-metadata">

**Author:** ![gotbassoon](https://avatars.discourse-cdn.com/v4/letter/g/0ea827/32.png) [@gotbassoon](https://forum.freecodecamp.org/u/gotbassoon)\
**Post date:** [February 9, 2017, 9:28pm UTC](https://forum.freecodecamp.org/t/challenge-use-css-selectors-to-style-elements/77067/6 "2017-02-09T21:28:57Z")

</div>

Hi,

Yes, I did get it to work. I deleted the entire h2 element and adding it back got it to work.

```auto
<style>
h2 {color: blue;}
</style>
<h2>CatPhotoApp</h2>

<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>

```

That’s the code I used that passed.

---

<div class="post-metadata">

**Author:** ![tsell9](https://avatars.discourse-cdn.com/v4/letter/t/9d8465/32.png) [@tsell9](https://forum.freecodecamp.org/u/tsell9)\
**Post date:** [March 24, 2017, 1:36am UTC](https://forum.freecodecamp.org/t/challenge-use-css-selectors-to-style-elements/77067/7 "2017-03-24T01:36:31Z")

</div>

Did you get an answer? I’m having the same problem.

---

<div class="post-metadata">

**Author:** ![abs73129](https://avatars.discourse-cdn.com/v4/letter/a/ce73a5/32.png) [@abs73129](https://forum.freecodecamp.org/u/abs73129)\
**Post date:** [March 24, 2017, 8:52pm UTC](https://forum.freecodecamp.org/t/challenge-use-css-selectors-to-style-elements/77067/8 "2017-03-24T20:52:00Z")

</div>

I had to use Google chrome and it seems to fix a lot of issues I had

---

<div class="post-metadata">

**Author:** ![tsell9](https://avatars.discourse-cdn.com/v4/letter/t/9d8465/32.png) [@tsell9](https://forum.freecodecamp.org/u/tsell9)\
**Post date:** [March 26, 2017, 4:41am UTC](https://forum.freecodecamp.org/t/challenge-use-css-selectors-to-style-elements/77067/9 "2017-03-26T04:41:47Z")

</div>

I just tried Google Chrome and it didn’t work either. Thanks for letting me know it works better for you though.

---

<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:** [January 16, 2021, 2:47pm UTC](https://forum.freecodecamp.org/t/challenge-use-css-selectors-to-style-elements/77067/10 "2021-01-16T14:47:40Z")

</div>

Closed on January 16, 2021, 2:47pm UTC


