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.

CSS CSS Basics (2014) Basic Layout Backgrounds: Size and Position

Aakash Srivastav
Aakash Srivastav
Full Stack JavaScript Techdegree Student 11,626 Points


Whats the difference between - background-size: 100% 100%; and background-size: cover; Please explain . I read articles and also took help of w3c , but didn't found any result.

1 Answer

Patrik Horváth
Patrik Horváth
11,097 Points

old theme : https://teamtreehouse.com/community/explain-the-difference-between-the-100-value-in-backgroundsize-property-and-cover-value

and my answere stay same :


is same as

 background-size:100% auto;

= the width is set to be 100% large and the height of the background image follows respecting the image aspect ratio.


means the background image will always fit the whole div , you won't be left with any empty spots in your div

background-size:100%  100%;

won't leave any empty space too, but of course this will destroy the original image aspect ratio