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

Re: Background image cropping

From: Dirk Schulze <dschulze@adobe.com>
Date: Wed, 11 Jun 2014 15:34:56 +0000
To: Marat Tanalin <mtanalin@yandex.ru>
CC: Sylvain Galineau <galineau@adobe.com>, Tab Atkins Jr. <jackalmage@gmail.com>, Lajos Koszti <ajnasz@ajnasz.hu>, "<www-style@w3.org>" <www-style@w3.org>
Message-ID: <A1A29470-5C36-412B-8578-CEF2F9834EC8@adobe.com>

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

> 11.06.2014, 04:52, "Sylvain Galineau" <galineau@adobe.com>:
>> On Jun 10, 2014, at 5:30 PM, Marat Tanalin <mtanalin@yandex.ru> wrote:
>>>  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...
> Based on whay you say, it looks like that Media Fragments cause a separate HTTP request for each region of the same image (one image => multiple HTTP requests).

Browsers separate the image source from the media query. It is unlikely that you get multiple requests with one image just because you use different media fragments.

Also, media fragments donít just affect CSS. They can be used with HTMLís <img> tag and SVGís <image> element and in theory even with <video> and <audio>. What I mean with that: It is a good idea to have a solution that fits many use cases. Especially when the feature is that simple.

Yes, you can not use calc() in CSS but canít in Media Fragments. So far I did not see a good use case where you want to do that. Most of the time you have an intrinsic size and the crapped content is at a certain position. However, the responsive images user group is experimenting with intelligent content fitting solutions. Maybe you want to get involved in this topic?


> This is the contrary to the main idea behind sprites that consists of uniting multiple images into a single image file to _minimize_ the number of HTTP requests (multiple images => one HTTP request).
> If so, MF look like not suitable for the purpose of spriting at all.
Received on Wednesday, 11 June 2014 15:35:47 UTC

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