Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

SeHyun Choi
3,441 PointsHow to make background-image responsive
I tried
background-image:url(" "); background-size:cover; background-repeat:no-repeat;
But when the screen gets to certain size (small) it doesn't show all the image. How do I fix that?
3 Answers

Steven Parker
221,046 PointsIt's normal for "cover" to trim off parts of the image to maintain the aspect ratio.
You could use "contain" instead of "cover" to insure the whole image is displayed, but then either the image will repeat or you get blank areas on the sides or top and bottom (known as "letterboxing").
The alternatives to these would distort the aspect ratio, which is generally even less desirable.

Lan Huynh
Front End Web Development Techdegree Student 5,906 PointsIf aspect ratio is not important to you, "background-size: 100% 100%;" is probably one way.

SeHyun Choi
3,441 PointsThank you everyone for your help.