Bummer! You have been redirected as the page you requested could not be found.

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 can there be a fraction of a pixel?

In this "Select and Style by Element" CSS video, Treasure shows us how to change letter-spacing, including to use decimals (e.g. .2px). I don't see how this is physically possible, as a pixel is a discrete physical unit. It cannot be divided into fractional values.

1 Answer

The short answer is that a pixel in CSS doesn't necessarily mean one pixel on your physical device. In reality, 1px in CSS is the size of the reference pixel, which is calculated as the visual angle of a pixel on a 96dpi screen at arm's length, assuming a nominal arm's length of 28 inches. Based on all this, the nominal angle is considered to be 0.0213ΒΊ, which means a CSS pixel is 0.26 mm, or 1/96th of an inch, which is not necessarily the size of a physical pixel on your actual device. For more information on this, I'm gonna go ahead and defer to this excellent StackOverflow answer

Thanks for your informative response! I suspected that it might be some tricky nomenclature that doesn't quite line up with reality (akin to how a 2x4 isn't 2"x4"), which Treasure spared us newbies from having to learn just yet.