Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm not a web designer. Can you explain to me why it's important to be able to position/size something to exactly N pixels, rather than to exactly kN pixels (where k is some integer decided by the browser implementor)?


The biggest reason is that most css properties ignore fractional px values—you can't draw a .5px border, for instance.


Which is absurd, because antialiasing exists for that very reason. I should be able to render a single-pixel-thick vertical line between two columns of display pixels, and get two columns of display pixels at 50% (apparent) brightness. Subpixel rendering would be even better.


This is only true in some UAs.

Gecko has supported fractional pixel values for years in general, though for borders in particular the width is clamped to integer _device_ (not CSS) pixels.

WebKit has been rounding them at parse time (even in cases when 1 CSS px is multiple device pixels) for a while, but they're about to fix that.

I believe that IE also supports subpixel layout. Not sure about Opera, offhand.


Images and <canvas> and <embed> use actual pixels. It's hard to make things look right when you don't have the same unit in CSS.


Maybe I'm misunderstanding, but I don't think this is correct; the browser should scale everything. See http://joubert.posterous.com/crisp-html-5-canvas-text-on-mob... for example.




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

Search: