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 trialJohn Haupenthal
2,749 PointsWhy did you use em when setting padding and pixels when setting a bottom margin for the banner div?
Question says it all. Why use em for padding and pixels for margins?
2 Answers
ghazikerkeni
7,873 PointsFor the vertical layout, we usually use pixel which is the unit by default, for the horizontal layout, we use percentage or em or rem (relative em) which helps with responsive layout.
iuliana sagaidak
4,797 PointsBecause it's responsive, so in different size of devices it will change proportionally
John Haupenthal
2,749 PointsBut then why use pixels for the bottom margin of the banner div?
iuliana sagaidak
4,797 Pointsiuliana sagaidak
4,797 PointsBecause it's responsive, so in different size of devices it will change proportionally