Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Hi, I am trying to change color of my h2 to a different color in css, but when I refreshed it, the code does not work.

I tried to change color of my h2, but when I refreshed it, it did not work. Am I missing a punctuation, or did I mess it up? How can I attach a screenshot of my codes here so you can see how I coded it? What is "fork" the workspace by the way. Thank you

2 Answers

Steven Parker
Steven Parker
243,318 Points

Screenshots are rarely helpful in analyzing a problem, but a snapshot, which is a read-only copy of the entire workspace, can be very handy. Click the highlighted word to see a video about how to make and share them.

The term "fork" essentially means "make a copy of". This is the first step I perform on a snapshot that someone posts, and then I can try out the code for myself.

If you make a snapshot and post the link to it here, I can use it to give you an answer about your h2 color issue.

Thank you, this is the link/snapshot to my code. https://w.trhou.se/qqgtdb7l84 . It seemed to work now. All I did for it to work now, is I named the class in index.html to section-title. I am thinking of making more lines later on in my resume in h2 format,so I wanted to assign only that specific h2 ,a color blue. So I named it randomly with Summ-qual at first. That's when the code did not work(when h2 did not change color). Then now when I changed it to section-title, it worked. Is there a rule in naming h2 or classes? Can't I just name them according to how I want to name them?

Hey Marie! Well there is really only two options here, perhaps you syntax is incorrect, you should do it like this:

h2 {
  color: red;
}

If this code does not work, you have probably linked your stylesheet incorrectly in your html file. Please write back if you need more help!

Thank you, it is working now. The only thing I did now to make it work is change the class name to section-title. I used a different name for the class earlier when it did not work. And now when I changed it to section-title, the codes worked. I was wondering if there is a rule in naming classes, I named it Summ-qual at first, its just my shortcut for Summary of Qualifications. I could not think of a better name earlier, so that's what I named it to. Then it did not work.

Hey again Marie! Glad that it works now, in terms of the class name, it should not make a difference. You can call a class whatever you like(except for a few rules, like not using spaces in the class name). The class "Summ-qual" should work perfectly fine, but you have to ensure that you are sellecting the exact same name in your CSS as in you HTML. Perhaps you forgot to use a capital S in your style sheet, and so it did not recognize the class.