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 How to Make a Website Adding Pages to a Website Add Iconography

About 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.

Jesus Mendoza
Jesus Mendoza
23,288 Points

Probably to show you that you can use multiple values to set width and height

1 Answer

Andrew Larson
Andrew Larson
12,912 Points

In 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