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 trialshao chang
865 PointsAbout background-size: 20px 20px;
In the video, why are we setting two values (20px 20px) to the background-size to make a square instead of one value? I was under the impression that setting one value and css will think it's 20px all around.
1 Answer
Andrew Larson
12,912 PointsIn the case of background-size it does not apply the same value. If only one value is given the second value is set to auto. While this may not create a problem in this situation as the image will proportionally scale this will not always be the situation.
For further details the MDN documentation on Background-size has more detailed information. https://developer.mozilla.org/en-US/docs/Web/CSS/background-size
Jesus Mendoza
23,289 PointsJesus Mendoza
23,289 PointsProbably to show you that you can use multiple values to set width and height