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 trialAidan Palmer
5,844 PointsWhy use ems? They seem to be a huge problem compare to %'s and rems.
Why have so many different types of scaling units whenever only a few seem to ACTUALLY make sense. It seems like the other units of scale make it much easier to scale and create.
2 Answers
Steven Parker
231,275 PointsSometimes you may want to size a container to fit closely to text contents within it, without regard to the window size or the base document font. For this purpose, the "ems" measurement would be very handy.
Ryan Larsen
2,722 PointsThe original question is the same logic that popped into my mind as well. Searching online I found some points that cleared it up a bit further...
Use em units for sizing that should scale depending on the font size of an element other than the root. (I think Steven gives a good real world example of useful application in regards)
Use rem units unless youโre sure you need em units, including on font sizes.
Use rem units on media queries
Donโt use em or rem in multi column layout widths - use % instead.
Donโt use em or rem if scaling would unavoidably cause a layout element to break.