Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS CSS Basics (2014) Basic Layout Width and Height Properties

Lane Fragomeli
Lane Fragomeli
5,259 Points

In the .arrow class when Guil downsizes the svg image of the arrow, he suggests a width of 50 px, but could this be 3em?

Is there a "best practices" for using px or em's for inline elements. For example he asks for 50 px to downsize the .svg image of the down arrow. So, I calculated that 3em would be the equivalent of 48 px- which is close. I tried that and refreshed and it looked the same. So my question is: Is there a general "rule of thumb" to follow when choosing between em and pixels for inline images (or elements)? What's the distinction, if any?

Lane

2 Answers

Steven Parker
Steven Parker
217,577 Points

It depends on your intentions. If you're creating something of a specific size then it makes sense to use pixel dimensions. But if you're creating something that should vary in size with the selected font, then ems would be a better choice.

Lane Fragomeli
Lane Fragomeli
5,259 Points

Thanks Steven, that makes sense. you rock.