Challenge Use CSS Selectors to Style Elements

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.

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

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

   h2{
       color: blue;
      }
   </style>
1 Like

I cleaned up your code.
You need to use triple backticks to post code to the forum.
See this post for details.

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

1 Like

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!

2 Likes

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?

1 Like

Hi,

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

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

2 Likes

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

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

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