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

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 UTC