RE: [css3-values] new editor's draft (and [css3-box])

Actually this wouldn't handle the target scenario of never scaling an image on client. Being a perfectionist photographer who wants to make sure any image scaling is done by the most advanced software, I would still be forced to write script that makes sure image size in device pixels is the perfect match to intrinsic size.

From: rocallahan@gmail.com [mailto:rocallahan@gmail.com] On Behalf Of Robert O'Callahan
Sent: Monday, January 19, 2009 2:37 PM
To: Alex Mogilevsky
Cc: David Hyatt; Håkon Wium Lie; Christoph Päper; www-style@w3.org
Subject: Re: [css3-values] new editor's draft (and [css3-box])

On Tue, Jan 20, 2009 at 11:15 AM, Alex Mogilevsky <alexmog@microsoft.com<mailto:alexmog@microsoft.com>> wrote:

"device-pixel-ratio" would be one of the ways to make it work (although setting sizes will be tricky and involve fractional pixels). Not sure if it's better than simply letting people use device pixels, since it makes it possible anyway.

I think for your use-case it's actually significantly easier to use device-pixel-ratio.

.image { background-image: url(1x.jpg); background-size:100%; width: Wpx; height: Hpx; }
@media (min-device-pixel-ratio: 1.5) { .image { background-image: url(2x.jpg); } }
@media (min-device-pixel-ratio: 2.5) { .image { background-image: url(3x.jpg); } }

Adding more image sizes is easy (whether you use fractional scalings or not) and you can be sure that the extra rules won't break your layout (or zooming), even if you get something wrong, because the image width and height remain specified in one place.

Rob
--
"He was pierced for our transgressions, he was crushed for our iniquities; the punishment that brought us peace was upon him, and by his wounds we are healed. We all, like sheep, have gone astray, each of us has turned to his own way; and the LORD has laid on him the iniquity of us all." [Isaiah 53:5-6]

Received on Tuesday, 20 January 2009 06:14:59 UTC