Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
CSS “px” is an Angular Measurement? (inamidst.com)
61 points by secoif on Nov 4, 2013 | hide | past | favorite | 16 comments


Here I found a post where it says the posted link is wrong: http://omnicognate.wordpress.com/2013/01/07/in-css-px-is-not...


right. looks like this one is debunked.


And that article is in #1 spot in HN and of course, OP article itself is linked in article!


It's #1 now.


Gah, FML and damn you Monday morning. I meant to say it IS IN #1. Corrected my comment.


Yep. It's in the spec.

http://www.w3.org/TR/CSS2/syndata.html#length-units

"pt: points — the points used by CSS are equal to 1/72nd of 1in.

px: pixel units — 1px is equal to 0.75pt.

The reference pixel is the visual angle of one pixel on a device with a pixel density of 96dpi and a distance from the reader of an arm's length. For a nominal arm's length of 28 inches, the visual angle is therefore about 0.0213 degrees. For reading at arm's length, 1px thus corresponds to about 0.26 mm (1/96 inch)."

So pixel units are intrinsically tied to dpi. Nobody cared when most monitors were 72dpi/96dpi


People did care. Monitors aren't everything. Printers are typically at least 300dpi, and printing that at 1:1 would result in minuscule text.


While the headline is nominally true, I don't thing this discussion is complete without talking about how browsers map this concept to actual device pixels ... particularly since they don't know how far the user's eyes are from the screen :)


Yes, particularly given that the spec explicitly says that for "lower-resolution devices" (i.e., normal computer monitors) the px unit should "refer to the whole number of device pixels that best approximates the reference pixel." So it turns out the px unit has quite a lot to do with screen pixels.


While an interesting bit of trivia... this is completely pedantic.

To say that it is "doesn't really have anything to do with screen pixels, despite the poorly chosen name" is just silly.

It's quite obvious that px means pixel, has everything to do with it, and that the non-linear angular measurement is just a kind of more "formal" definition, but which no browser has ever actually followed, or probably ever will.


A 91 ppi pixel is nothing like a 300 ppi pixel, so this "pedantic" definition matters. Particularly as retina-like displays become more and more common.

And whether they are doing it to the same accuracy as this article recommends or not, browsers are not simply rendering 1px as one pixel width regardless of the display resolution - My 2 year old iPad with a retina display demonstrates this well.


> No matter how large a value you put in for px, you'll not be able to reach 180 degrees.

actually I only had to put in 10 9s to get 180...


This article is approximately complete nonsense.


Hasn't this been true for a while?


Sure it does!


Suffering from the HN effect.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: