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 CSS Basics (2014) Basic Layout Backgrounds: Size and Position

background-repeat: no repeat necessary if the size value set to Cover?

If we set the size value to Cover it means the background image will always fit the whole div , you won't be left with any empty spots in your div, then why do you need the no-repeat or position the image to center?

1 Answer

If you use background-size: cover, there shouldn't be any need for the background-repeat or the background-position attributes. As you said, the background-size: cover makes sure that the image scales to the size of the div, making the other attributes redundant.