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 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
231,007 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.