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 How to Make a Website Customizing Colors and Fonts Resize Text

jemelleesantos
jemelleesantos
3,495 Points

Em vs. px

Is there a breakdown or a compare/contrast article on ems and pxs?

I still can't quite understand his explanations of what ems are. I've always used px in the past and em is new to me.

mrx3
mrx3
8,742 Points

Google has a bunch A http://www.impressivewebs.com/understanding-em-units-css/ Good article here. Hope this helps

4 Answers

Good explanation here: http://css-tricks.com/why-ems/

In simplest terms, ems are a scalable unit of measurement, whereas pixels are more of a physical measurement, and more to do with the monitor or device.

A pixel is a physical point in a raster image, or the smallest addressable element in an all points addressable display device; so it is the smallest controllable element of a picture represented on the screen. β€”Wikipedia

In Cascading Style Sheets, the "em" unit is the height of the font in nominal points or inches. The actual, physical height of any given portion of the font depends on the user-defined dpi setting, current element font-size, and the particular font being used. To make style rules that depend only on the default font size, another unit was developed: the rem. The rem, or root em, is the font size of the root element of the document. Unlike the em, which may be different for each element, the rem is constant throughout the document. β€”Wikipedia

I'm also interested in this information about ems . I'm looking forward to learn more about the difference between ems and px .

You might also check out Type Scale. Many thanks to Mattox Shuler and his Web Typography course.