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

WordPress From Bootstrap to WordPress Create Bootstrap Styled Theme Templates Creating a Portfolio Single Page

Kate Moore
Kate Moore
22,916 Points

Is there a reason to use px instead of ems?

For the previous/next buttons in this video he uses px and then resizes with a media query. Is this just a matter of habit or is there a reason to use px? I have been slowly converting my brain to use ems for everything but have come across a few wordpress plugins that will only let me use px for font sizes. Is there a reason I should be using px? Or should I just sit back and wait for the world to adapt to ems?

1 Answer

Kevin Korte
Kevin Korte
28,148 Points

Ems are relative, pixels are of course not, so it cases like buttons, it would make sense that you might want a button to be 50px tall whether its on desktop or mobile.

If there is no need for the element to grow relative to it's parent, there is no need to take the risk using ems.