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

HTML How to Make a Website Adding Pages to a Website Add and Style Icons

Don't understand why I got Challenge task 4 correct!

Challenge task 4 of 5 asks: "With the anchor elements inside the contact-info list still selected, set the background size to 20 pixels square. Then set the left padding to 30 pixels, with all other padding at 0."

My CSS was as follows: background-size: 20px 20px;

My answer is correct, but I don't understand why. At first, I answered "20px." When I discovered that my initial answer was incorrect, I guessed the correct answer. I don't understand why repeating 20px is the correct answer. It works but I don't really know why it works. Receiving positive feedback is great when one completes a challenge, but my goal is to really understand what I'm doing.

Can someone please explain why "background-size 20px 20px" is correct.

3 Answers

Colton Fitzgerald
Colton Fitzgerald
15,815 Points

It's great you asked! Here's the reason why two is correct.

The first "20px" is for the width of your background's size and the second "20px" is for the height. Here's an example:

In the statement "background-size: 40px 20px;" It will be 40px wide and 20px tall.

Wow! That was simple ... THANK YOU ... I got it now. I guessed the answer based on the "square" in the question, but I wasn't confident. I got it now.

idan ben yair
idan ben yair
10,288 Points

Yup Colton is on point.

Check out this info as well:


w3 website is very helpful when you are trying to understand things of this nature.

Thanks for the link to an additional resource. I will check it out!

idan ben yair
idan ben yair
10,288 Points

No problem Ronald anytime! :)