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
Michael Williamson
Front End Web Development Techdegree Graduate 23,903 PointsResponsive background images
When using a background image by CSS. How do you get the image to contain itself within smaller screen sizes and then when re-sizing stays proportional to its screen size. Is there a pixel by pixel ratio to save the image at? Do you use different image sizes of the same image and create media queries? Maybe some Javascript?
1 Answer
Joel Shaw
1,731 PointsFor this, I usually just use "background-size: cover;", but apply it to each of my breakpoints. This way it inherits the width of the screen resolution that you're working with.