5 ms·
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 (w
by colanderman 15y ago
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)?
- mikeklaas 15y agoThe biggest reason is that most css properties ignore fractional px values—you can't draw a .5px border, for instance.
- evincarofautumn 15y agoWhich 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.
- bzbarsky 15y agoThis 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.
- tlb 15y agoImages 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.
- wmf 15y agoMaybe 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-mobile-phones-and http://joubert.posterous.com/crisp-html-5-canvas-text-on-mob... for example.