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 trialStefan Pupcevic
1,306 PointsCan we just use background-size: 100%; for background image size?
Can we just use that function instead of messing with repeat? I used it and it looks good and stretched!
1 Answer
Steven Parker
231,261 PointsThere are a variety of background size settings, as you discovered you can stretch it to fit, and two popular settings that do not affect aspect ratio are "contain" and "cover".
For more details on these and other settings, see the MDN page on background-size.
Trevor Tinotenda Manhuwa
Front End Web Development Techdegree Student 2,512 PointsTrevor Tinotenda Manhuwa
Front End Web Development Techdegree Student 2,512 PointsHi, try apply applying the following:
Background-size: Cover; Background-position: Center;
This might give you desired results