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

How to get background image to scale.

I have a background image with in my header tag. I just can't get it to scale down in size when narrowing browser.

... header { width: 60%; height: 700px; margin: auto; background-image: url("/applications/mamp/htdocs/claire/images/bowl.jpg"); background-size: cover; background-position: centre;

...

1 Answer

Hey William,

Give the following line a try inside of your header rule in place of your existing background-size: cover; declaration, it may be what you're looking for:

   background-size: 100% 100%;

It will still likely require some tweaking, but it generates the effect you seem to be looking for.

Good luck!