W3C home > Mailing lists > Public > www-style@w3.org > June 2014

Re: Background image cropping

From: Sylvain Galineau <galineau@adobe.com>
Date: Wed, 11 Jun 2014 00:52:44 +0000
To: Marat Tanalin <mtanalin@yandex.ru>
CC: Dirk Schulze <dschulze@adobe.com>, Tab Atkins Jr. <jackalmage@gmail.com>, Lajos Koszti <ajnasz@ajnasz.hu>, "<www-style@w3.org>" <www-style@w3.org>
Message-ID: <805CC235-063B-49C0-B06A-E5A3E8B333C8@adobe.com>

On Jun 10, 2014, at 5:30 PM, Marat Tanalin <mtanalin@yandex.ru> wrote:

> 10.06.2014, 19:58, "Sylvain Galineau" <galineau@adobe.com>:
>> On Jun 10, 2014, at 8:16 AM, Marat Tanalin <mtanalin@yandex.ru> wrote:
>>>  10.06.2014, 18:44, "Dirk Schulze" <dschulze@adobe.com>:
>>>>  I believe Mozilla has a -moz-image-rect() [1] image function that clips the input image argument. It is not specified though.
>>>> 
>>>>  Dirk
>>>> 
>>>>  [1] https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-image-rect
>>>  By the way, Mozilla's `-moz-image-rect()` functional notation looks much better than Media Fragments in CSS for several reasons
>> Yes, I agree the readability and usability of a URI fragment are poor. A functional notation that would result in the client requesting the image using the corresponding media fragment URI sounds interesting. As long as it does not result in the kind of poor user experience described above.
> 
> To be clear: my point is that while Media Fragments in general may make some sense as a compact way to pack some meta data into URL for the purpose of somewhat easy sharing the URL as a standalone thing, I doubt we should stick with Media Fragments _in CSS_ while there are more intuitive, usable and flexible options consistent with the rest part of CSS.
> 
> After all, Media Fragments and pure-CSS solutions are not mutually exclusive.

Precisely.

> Media Fragments could be used in CSS for some simplest cases, while pure-CSS solutions could be used as a more flexible and usable alternative when needed.
> 
> For example, how would following expression be expressed in terms of Media Fragments?
> 
>    /* Here we have 4em-size center part of the image: */
>    -moz-image-rect(
>        calc(50% - 2em),
>        calc(50% - 2em),
>        calc(50% - 2em),
>        calc(50% - 2em)
>    )

In cases like this you'd need the full image to compute the result anyway, so it's not really a scenario for MF. 

This thread started with background sprites as they are currently built on the web. Those can certainly use MF, though some syntactic sugar to build the fragment may be nice...
Received on Wednesday, 11 June 2014 00:53:18 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:22 UTC