W3C home > Mailing lists > Public > www-style@w3.org > October 2008

Re: [css3-mediaqueries] feedback on device-aspect-ratio, aspect-ratio and orientation

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Fri, 31 Oct 2008 07:47:16 -0700
Message-ID: <490B1A74.7020903@mit.edu>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
CC: www-style@w3.org

Tab Atkins Jr. wrote:
>     Wouldn't that make it difficult (or impossible, since css3-values says
>     numbers are reals rather than particular precision floats) to match some
>     aspect ratios like 4:3?  Wouldn't the author then be forced to write
>     something like:
>      (min-aspect-ratio: 1.333) and (max-aspect-ratio: 1.334)
> Almost this exact discussion came up on the WHATWG list about <video> 
> aspect ratios.  ^_^  Ian has so far kept the aspect ratio a float.  His 
> argument is that the precision with which we store floats is *vastly* 
> greater than the differences between aspect ratios in use today or in 
> the relatively near future, and so the difference between a given ratio 
> and the closest-approximation float is irrelevant.

I'm not sure I follow...

The use case at hand is to target 4:3 aspect ratios.  Since 
"aspect-ratio" would do an equality comparison, and since CSS uses 
decimals to represent real numbers, I would have to either do:

   (aspect-ratio: 1.3333333333333333333)

with the number of '3's depending on the precision of the floating-point 
numbers used by the UA (because if I don't have enough, the UA will 
treat that number as different from 4.0/3.0).  Since the precision is 
not defined anywhere, to get this to work I have to put in more digits 
than any UA might have.  That's a nasty requirement on content authors. 
    The very precision with which we store floating-point numbers is the 
problem here.

The other option is to do what Cameron suggested and use something like:

   (min-aspect-ratio: 1.333) and (max-aspect-ratio: 1.334)

This does leverage your "differences between aspect ratios used today 
are small" idea, but is incredibly unintitive to author.  I see no 
reason we should force authors to do a nasty hack like this for what is 
likely a common use of this feature.

With the current syntax, I just write:

   (aspect-ratio: 4/3)

and I'm done.

Received on Friday, 31 October 2008 14:48:10 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:40 UTC