Re: The picture element: complexity

On Thu, 12 Sep 2013 16:43:23 +0200, Reinier Kaper <rp.kaper@gmail.com>  
wrote:

> If I may pitch in on this discussion from a front-ender's perspective: I
> don't see why we would ever want to have media-queries in our markup,  
> isn't
> the separation of HTML and CSS one of the goals?
>
> I get this is an edge case, as it concerns serving images, which is
> technically not CSS related, but the media queries are.

Media queries are used in CSS, but that doesn't mean that media queries  
can't be used outside of CSS.

> Why can't we do something like <img src="some-lowres.jpg,
> somewhat-higher-res.jpg, very-high-res.jpg" > and then use CSS selectors  
> to
> decide which src to apply?
> Very rough example:
> @media (min-width: 18em) {
>   img {
>     src: 1 // This would be an index based number and if not found,  
> default
> to 0
>   }
> }

Because browsers want to start downloading the correct image before  
stylesheets have been downloaded and parsed.

-- 
Simon Pieters
Opera Software

Received on Thursday, 12 September 2013 14:50:36 UTC