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

Body background-size set to cover, my 2 divs' "backgrounds" don't use the image from the body background, why?

I am making a website, and for the home page I set the body background-size to cover. Inside the body I have two divs, each has an image and an h1. For some reason the divs don't show background image that I set for the body. How can I fix this?

Could you show what you did?

I will agree with Ashley on this, but its best if you could paste your code into the question so we can see what's going on, it would be a lot easier to help. Do you want the image's in the two div's to show or do you want the two div's to show the body background image?

2 Answers

You need to set the background of the divs to transparent or none as they are ontop of your documents body in the cascading rules.

#your_div_here {
   background: transparent;
}

or

#your_div_here {
   background: none;
}

None is used when the element has no background properties set at all. Transparent is used when your element has other background properties set but the color is set to transparent.

thank you so much! the background: none worked perfectly!