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

When should we still use PX instead of EM?

A big lesson on the CSS basics course is that we should be primarily using the EM value. When should we still be ok with using PX if at all? I know we have to keep responsiveness in mind but I still see a lot of sites heavily use PX.

1 Answer

Steven Parker
Steven Parker
243,656 Points

I'm not sure that I would agree with "primarily" using em units. They are certainly useful when you want to specify dimensions that will adapt to changes in font size, but there are also plenty of times where you want to set fixed dimensions.

Each choice will need to be made by considering what the dimensions are being applied to, and if the size is intended to be relative to the font or not.