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 trialAkai S
8,857 PointsIs there a difference in typing
I was curious to know if there is any difference between writing:
.selector {padding-top: 60px;}
.selector {padding: 60 0px}
.selector {padding-bottom: 60px;} than
I learned the other way from Nick that you can type 4 different sizes for each side. and just typing two different sizes, the first one will affect the top and bottom and the other one the left and right side.
2 Answers
edeharrison
Full Stack JavaScript Techdegree Student 11,127 PointsHi Davide,
I don't think your code's come up properly. But yes, that's the logic behind it; if you write four values:
padding: 10px 1px 10px 1px;
That targets the padding on the (from left to right) top, right, bottom, left. And this would be the same as writing:
padding: 10px 1px;
And if you wanted the values to be all the same (for example, 1px on each side), you could abbreviate it even further to:
padding: 1px;
Hope that helps,
Ede
Akai S
8,857 PointsThanks ! :)
Jaime Rios
Courses Plus Student 21,100 PointsJaime Rios
Courses Plus Student 21,100 PointsJust as a side note, if you wanted to have those values
It is best practice to do it this way: