[whatwg] Implementation complexity with elements vs an attribute (responsive images)

Benjamin Hawkes-Lewis bhawkeslewis at googlemail.com
Sun May 13 13:17:06 PDT 2012


On Sun, May 13, 2012 at 8:55 PM, Bjartur Thorlacius
<svartman95 at gmail.com> wrote:
> But the chosen image resolution might be a factor for choosing layout.

Maybe we should think of a way to expose _that_ information to CSS,
rather than going in the other direction.

<section>
  <img src="a.jpg" alt=""
       set="a.jpg 600x200 1x,
               b.jpg 600x200 2x,
               c.jpg 200x200">
</section>

section { /* generic style rules */ }
section! img:intrinsic-aspect-ratio(<2) { /* specific overrides for
section when the UA picks the narrow image */ }

--
Benjamin Hawkes-Lewis



More information about the whatwg mailing list