Re: css layout should be symmetrical

Christian Wolfgang Hujer <Christian.Hujer@itcqis.com> wrote on 2/15/02 
3:22:41 AM: 
>> That's to say that, for example, it should be possible to have <th>s at
>> top, left, right and bottom of a table - or at least two dimensions
>> simultaneously. I just finished making a table that had a row at the top
>> and a column at the left that were both structurally headers, and I'm sure
>> I'm not alone. Colgroups are not the same thing - more like a parallel of
>> tbody.
>What's the point? I think I won't understand this until you show me a source 
>code example.

I didn't really understand this part either.

>> Similarly, it should be as easy (and also take a parallel or identical set
>> of commands) to centre a block horizontally as vertically. I think it was
>> pointed out in the "How is it possible to devise such a feeble system"
>> thread that this is not currently the case.
>Using a table with width and height properties and cells with text-align and 
>vertical-align properties this can already be done, though this will be 
>improved in CSS Level 3 as far as I read the working drafts.

Phil, and I in that thread, meant _without_ using a table, a table hack, or 
any other kind of hack.  It seems to be some kind of running gag that there 
is no straightforward way to horizontally and vertically center a block or 
the contents of a block in CSS.  I can't imagine a more fundamental layout 
scenario. 

I also think, as others have pointed out, that the box model is seriously 
flawed.  I think it would be better if blocks behaved more like tables have 
so that instead of automatically growing to the available width they become 
only as wide as their content requires, and so that you can nest them and 
horizontally and vertically center one within another easily.  It is easy to 
set "width: 100%;" or "height: 100%;", difficult / not intuitive to use 
margins to determine the width / width, especially to center a block.  Don't 
waste your time trying to figure out how to vertically center one block 
within another, you can't do it period using margins.  Why not just set an 
explicit width / height and let the margins take up the slack? 

For several reasons (not counting lack of browser support, e.g. IE 5 Win).  
Probably most importantly, you can't do it at all for the vertical axis.  As 
I said, I think the ability to horizontallly and vertically center blocks, 
not their content, without using margins would be more straightforward than 
the current system.  In the real world you don't have to worry about filling 
up every bit of space surrounding all objects with invisible, solid margins. 

As has been pointed out by others, the system of assigning a width / height 
to the content area of a block, to which the padding, border, and margin 
thicknesses will be added, is _extremely_ difficult to use.  In many cases it 
would be much more straightforward to be able to assign an overall width / 
height that will cause the slack to be taken up in calculating the dimensions 
of the content area.  This wouldn't necessarily have to replace the current 
system, why not have properties total-width and total-height or something 
like that? 

Why are tables so popular as a layout tool in web development?  Because they 
work.  Tables allow you to, with relative ease, create fairly complex layouts 
that are impossible or extremely difficult to create with CSS and no tables.  
What is wrong with a simple 2D grid model of layout powered by CSS (by 2D I 
don't mean to dismiss the stacking properties)? 

Received on Friday, 15 February 2002 17:47:11 UTC