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

HTML How to Make a Website Customizing Colors and Fonts Resize Text

Mully Bendet
Mully Bendet
637 Points

why is my h1 and h2 not green in backround

why

Seth Kroger
Seth Kroger
56,413 Points

Can you post the code you have? (Wrap your code with 3 backticks (```) on the line before and after, and optionally the language after the first set like ```html or ```css) Or take a snapshot of your workspace (camera icon in upper right) and share the link?

Shahar Ohayon
Shahar Ohayon
4,868 Points

If you can please post the code?

You can also try

h1,
h2 {
background: green;
}

2 Answers

paul white
paul white
13,958 Points

Is there another css declaration from somewhere else overwriting your declaration for the background color? Although it's not a best practice, try adding !important to your css and see if that helps. If so, you may have to hunt down what is overriding your css.

h1, h2 {
background: green !important;
}

You could also try getting more specific with your css by using background-color instead of background.

Katharine Cooney
Katharine Cooney
4,612 Points

I know this is delayed, but! I was having the same issue. My h1 and h2 were fine until this part of the lesson. I just scrolled through my text and realized that several of my selectors at the bottom of the file were highlighted red. I realized that I forgot to add a closed curly bracket } to one of my CSS rules! Maybe you were having the same problem.