W3C home > Mailing lists > Public > public-respimg@w3.org > May 2012

Re: Is algorithm for selecting based on media query defined?

From: Aaron Gustafson <aaron@easy-designs.net>
Date: Thu, 17 May 2012 07:22:04 -0700
Message-ID: <CALWPYzEVhup13G8bD0T7J59SjtyLi5wZ=6jvjT9ANPOgjgP9uA@mail.gmail.com>
To: Kornel Lesiński <kornel@geekhood.net>
Cc: public-respimg@w3.org, Matthew Wilcox <mail@matthewwilcox.com>
On Thu, May 17, 2012 at 7:18 AM, Kornel Lesiński <kornel@geekhood.net> wrote:
>
> What's the algorithm for selecting which image is picked based on media
> queries?
>
> e.g. which one will be picked in this case:
>
> <source media="all and (orientation:portrait)">
> <source media="all">
> <source media="all and (max-width:300px)">
> <source>
> <img>
>
> when screen is 200px wide in portrait mode?
>
> and which one when screen is 200px wide in landscape mode?
>
>
> Same question for this case:
>
> <source>
> <source media="all">
> <source media="all and (orientation:portrait)">
> <source media="all and (max-width:300px)">


Traditionally, the first to match is the one picked. In the video
element, this is why we put WebM before Ogg: the same browsers support
both, but WebM is smaller, so we put it first so it is the one that’s
downloaded.

Cheers,

Aaron

----
Aaron Gustafson
Principal
Easy Designs, LLC
+1 877 EASY 313 x101
aaron@easy-designs.net
@aarongustafson

=== OUT NOW ===
Adaptive Web Design: Crafting Rich Experiences with Progressive Enhancement
http://adaptivewebdesign.info
Received on Thursday, 17 May 2012 14:23:00 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 17 May 2012 14:23:00 GMT