- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Fri, 27 Sep 2013 15:38:59 -0700
- To: Brendan Long <self@brendanlong.com>
- Cc: Robin Berjon <robin@w3.org>, "HTML WG (public-html@w3.org)" <public-html@w3.org>
On Fri, Sep 27, 2013 at 12:42 PM, Brendan Long <self@brendanlong.com> wrote: > Sorry if this is a stupid question, but the use of media queries in the > src attribute brings up an interesting question: Why don't we just let > the src attribute be specified by CSS? > > <img alt="A cat" src="default-cat.jpeg" class="cat" /> > > img.cat { > @media (max-width: 600px) { > src: "smaller-cat.jpeg"; > } > @media (max-width: 400px) { > src: "even-smaller-cat.jpeg"; > } > } The spec isn't quite there yet, but this is intended to be handled via the existing 'content' property, along with a new value that indicates the given url() should be treated as a replaced element. But just to be clear, this is in no way a solution to the Responsive Images problem, as it means that you don't even start loading the image until CSS is downloaded and parsed, losing multiple seconds on mobile devices. ~TJ
Received on Friday, 27 September 2013 22:39:47 UTC