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
Zhenghao He
Courses Plus Student 2,389 PointsWhy does the instructor constantly use em to set padding instead of px?
I noticed that many times when he set the padding he always went with em. e.g. padding-left: 1em;
why didn't he use px? Is there a reason for this?
I know px is an absolute unit of measurement, em is not an absolute unit. It is a unit that is relative to the currently chosen font size. but what's the reason to choose em over px in his cases. he didn't explain
1 Answer
Kieran Barker
15,028 PointsThere isnβt really a specific reason why, to be honest. Itβs just another way of doing it.
laurabouley
5,745 Pointslaurabouley
5,745 Pointspx is an absolute unit of measurement, em is not an absolute unit. It is a unit that is relative to the currently chosen font size.