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

Re: [css3-grid-layout] semantic zoom in grid's templates

From: François REMY <fremycompany_pub@yahoo.fr>
Date: Fri, 24 Feb 2012 22:59:46 +0100
Message-ID: <F9F0C7A9779B4F1AA7B4ECD12E73AA72@FREMYD2>
To: "Phil Cupp" <pcupp@microsoft.com>
Cc: "CSS 3 W3C Group" <www-style@w3.org>
My reasoning is simple: the first representation (the "fraction bar" one) is 
easily readable, while the second one ("multiline template") is impossible 
to understand, and very complex to type. Also, the "multiple lines" string 
template is unstable. People that know me a little may know I hate unstable 
representations of a reality (ie: I hate it when a small change has big 
consequences on the code I need to write).

Please consider the initial situation (see attachment) where I have three 
columns, where the last one is divided in two rows. I want to represent that 
reality using the current grid-template syntax. I have to write 
grid-template: "abx" "aby". This seems simple and straightforward.

Then, for some reason, I need to add another column to the right which is 
divided in three rows. I have to change completely the code I wrote before 
and.... I have now 6 strings to write because I have 2 rows for one "cell" 
and 3 for another one (the GCM of 2 and 3 is 6). Intermediary result is 
grid-template: "abxr" "abxr" "abxt" "abyt" "abyu" "abyu".

After some time, I realize I would like to divide the upper right cell (r) 
in two columns (r and s). I have to modify my code another time. At the end, 
I get grid-template: "abxrs" "abxrs" "abxtt" "abytt" "abyuu" "abyuu", which 
seems pure garbage to me as it is completely unreadable.

On the other side, the "fraction bar" representation can handle many more 
cases in a single string, and using something very stable because you can 
replace any cell by a parenthesed expression, and thus divide the cell in 
subcells. From "ab(x/y)" I move to "ab(x/y)(r/t/u)" and then to 
"ab(x/y)(rs/t/u)". No code rewrite. No GCM calculation. I just think it's a 
better way to do grid templating. I can continue to complexify nearly as 
much as I want, I'll continue to have one string, and not multiple ones. 
However, yes, there are some edge cases you can't solve using grid-template 
at all, but they are not mainstream.



-----Message d'origine----- 
From: Phil Cupp
Sent: Friday, February 24, 2012 10:25 PM
To: François REMY ; Alex Mogilevsky ; Daniel Glazman ; Markus Mielke
Cc: CSS 3 W3C Group ; Alexander Shpack
Subject: RE: [css3-grid-layout] semantic zoom in grid's templates

> From: François REMY [mailto:fremycompany_pub@yahoo.fr]
> This proposal is quite simple: it would allow to define sub-cells using 
> parenthesis, and sub-rows using slashes. Strings using parenthesis and 
> slashes woud desugar in any number of string needed to have equivalent 
> output.
> Sample:
> grid-template:
> “ab(x/y)(rs/t/u)”;
>
>instead of
> grid-template:
>“abxrs”
>“abxrs”
>“abxtt”
>“abytt”
>“abyuu”
>“abyuu”;

[pcupp] What's the goal of the sub-cell(do you mean sub-column)/row syntax? 
In general the grid-template property can only express a subset of the 
layouts that are possible with the grid, so I see its utility purely as a 
means to visualize the grid you are trying to create.  I have a tough time 
seeing how the two template definitions above are equivalent, so IMO it 
fails the "easy to visualize test". 



grid-1.gif
(image/gif attachment: grid-1.gif)

Received on Friday, 24 February 2012 22:00:26 GMT

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