Re: [css-grid] Sizing of grid item elements

Hi,

On 22/08/14 17:08, Emil Björklund wrote:
>>> The second thing that struck me as counter-intuitive is that columns
>> sized
>>> with percentages on a grid container without an explicitly declared width
>>> won't get sizes according to a percentage of the grid container width,
>> but
>>> compute to "auto" width. In my example, I used the <body> element as the
>>> grid container, and wanted empty "spacer" columns on the side of the
>> actual
>>> contents, but they collapsed (to nothing, as they had no items/content).
>> I
>>> had to set "width: 100%" on the <body> element for them to get rendered,
>>> which felt superflous.
>>
>> I suspect another bug.  Percentages generally are able to resolve
>> against a "fill" width on blocks; there's no good reason they
>> shouldn't work as you expect here.  (In some cases they can't resolve,
>> when the size of the element depends on the size of the content, but
>> that's not the case for widths in "block" contexts by default.)
>>
> 
> Good to know, I'll make sure to file that one.

I was taking a look to this bug [1] and I think that current behavior
matches the spec [2]:
"If the inline or block size of the grid container is indefinite,
<percentage> values relative to that size are treated as 'auto'"

In that case we're talking about a "grid container without an explicitly
declared width" which seems indefinite.
So, current behavior would be right, and you would need to set the width
of the grid container to get the expected behavior.

Am I missing something?

Thanks,
  Rego

[1] http://code.google.com/p/chromium/issues/detail?id=407089
[2]
http://dev.w3.org/csswg/css-grid/#valdef-grid-template-columns-grid-template-rows-percentage

Received on Thursday, 16 October 2014 21:46:49 UTC