W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2013

Re: [whatwg] <imgset> responsive imgs proposition (Re: The src-N proposal)

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 12 Nov 2013 10:47:39 -0800
Message-ID: <CAAWBYDB==KOY3_x6poX-7dxObG5CNRXOeiv=A0tUQgrRgtPRUg@mail.gmail.com>
To: Anselm Hannemann <info@anselm-hannemann.com>
Cc: Markus Ernst <derernst@gmx.ch>, Ryosuke Niwa <rniwa@apple.com>, whatwg <whatwg@lists.whatwg.org>, Markus Lanthaler <markus.lanthaler@gmx.net>, "Jukka K. Korpela" <jkorpela@cs.tut.fi>, Adam Barth <w3c@adambarth.com>
[Please don't top-post.  Quote the relevant parts of the message
you're responding to.]

On Tue, Nov 12, 2013 at 10:44 AM, Anselm Hannemann
<info@anselm-hannemann.com> wrote:
>> On 12 Nov 2013, at 19:40, "Tab Atkins Jr." <jackalmage@gmail.com> wrote:
>>> On Tue, Nov 12, 2013 at 9:50 AM, Adam Barth <w3c@adambarth.com> wrote:
>>> We might even be able to make this work without inventing anything:
>>>
>>> <style type="text/css">
>>> @media (min-width: 480px) {
>>>  .artdirected {
>>>    width: 30px;
>>>    height: 30px;
>>>    background-image: image-set(url(small.png) 1x, url(small-hires.png) 2x);
>>> }
>>> }
>>> @media (min-width: 600px) {
>>>  .artdirected {
>>>    width: 60px;
>>>    height: 60px;
>>>    background-image: image-set(url(large.png) 1x, url(large-hires.png) 2x);
>>> }
>>> }
>>> </style>
>>> <div class="artdirected"></div>
>
> Really? An empty div element? What about accessibility or When CSS cannot be loaded? What if only html is grabbed by another page? It doesn't seem to be a really solid solution in my opinion.

Right, that's not great, but once we finally define the "replaced"
keyword for the 'content' property, you should be able to set it
directly on <img>s, like:

<style>
.foo {
  content: replaced image-set(...);
}
</style>
<img class='foo' src="fallback">

~TJ
Received on Tuesday, 12 November 2013 18:48:23 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:14 UTC