freeCodeCamp Challenge Guide: Use CSS Selectors to Style Elements

freeCodeCamp Challenge Guide: Use CSS Selectors to Style Elements


Instead of giving style attributes one by one, we can do this to multiple elements at the same time.

You can create a style element like this: <style></style>.

Inside that style element, you can create a CSS selector for any HTML Elements. For example, if you wanted all h2 elements to be red, your style element would look like this:

<style>h2 {color: red;}</style>

Note that it’s important to have both opening and closing curly braces ({ and }) around each element’s style. You also need to make sure your element’s style is between the opening and closing style tags. Finally, be sure to add the semicolon to the end of each of your element’s styles.



I am having a problem with using CCS Selectors to Style elements. Here is a snippet of everything I’ve done. I only have one X and I don’t know how to solve it.


I am having the same issue as well. Some help would be greatly appreciated.


Same. This needs to be fixed guys. We’ve clearly followed everything.


Here’s the solution guys:
< 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>

I had to make spaces inside tags to could show you the code itself, just remove the space and should be good.


This is not the solution on mine.
Anyone know how to rectify or move on to next task?


Hey XanderHall,

I see from your code in lines 2 + 3 that it looks a little jumbled, I had a similar issue in the placement of the CSS element. I would reset the code and keep CSS style element at the top and away from the actual (h2>CatPhotoApp</h2) as the CSS element will point to this when you declare it, so it should look a little like the code above and you’ll be rockin’!

Keep on keepin’ on :slight_smile:



I have completed this challenge with the same solution that many other users have come to submit.

The one issue that I ran into that may help others here is that the challenge sometimes does not recognize a correct solution when pasting in from an external text editor. I ran into this as I like to edit with an external text editor because it will auto-complete the tags. However, when pasting into the browser and submitting it is incorrect. I instead had to type the solution manually in the browser and submit, then it accepted as correct.

Hope this helps,



you have deleted your actual h2 element meaning youve made nothing blue.


anyone have an example of a period is? lesson says that a css starts with a period and a class declaration doesn’t and I’m confused on the difference of the 2.


I am just as confuse especially since I follow the lesson instruction accordingly. Is there a way that we can contact a admin staff directly with questions pertaining to this lessons?


Spacing seems to be an issue here, which seems off putting. Nonetheless it accepted my answer. :laughing:


the problem here is with your h2 element…it has no opening i.e