W3C home > Mailing lists > Public > www-style@w3.org > July 2012

Re: [css3-background] 'auto' value for background-size

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 2 Jul 2012 10:46:00 -0700
Message-ID: <CAAWBYDCPM80ZVFYknmp-2MRqi1nsvftZXwcpgws1WRFi94hb6Q@mail.gmail.com>
To: Joe Thomas <joethomas@motorola.com>
Cc: www-style@w3.org
On Tue, Jun 26, 2012 at 11:44 AM, Joe Thomas <joethomas@motorola.com> wrote:
> On Tue, Jun 26, 2012 at 11:40 AM, Joe Thomas <joethomas@motorola.com> wrote:
>>
>> Hi,
>>
>> I would like to get a clarification on having "auto" value for one
>> dimension in background-size property.
>>
>> As per the specification
>> http://www.w3.org/TR/css3-background/#background-size, an ‘auto’ value for
>> one dimension is resolved by using the image's intrinsic ratio and the size
>> of the other dimension, or failing that, using the image's intrinsic size,
>> or failing that, treating it as 100%.
>>
>> Assume that  background-size is specified as "auto 8px" and the
>> background-image used is of intrinsic size (2,32). Assume that the UA takes
>> 'integer' for width, then the width of the background image using
>> intrinsic-ratio computes to 0 {(2/32) * 8 = 0.5, which is rounded to 0 as UA
>> takes only integer for width}
>>
>> Does computing the width to 0 using intrinsic ratio can be considered as a
>> failure? What are the various types of failures that can happen while
>> resolving the dimension using intrinsic ratio?

The "failing that" clauses are for when some of the information in the
previous clause doesn't exist; for example, if the image doesn't have
an intrinsic ratio, it'll fail the first clause, and if it doesn't
have an intrinsic size in the missing dimension at all, it'll fail the
second clause too.

If the image has the necessary dimensions for a clause, but applying
the clause causes the browser to round that dimension to zero, it'll
fall into the "zero dimension" clause at the very end of the
property's definition, which makes it not be displayed.

~TJ
Received on Monday, 2 July 2012 17:46:47 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:56 GMT