Re: positioning and sizing an element relatively to any other element

On Mar 17, 2010, at 7:35 AM, Tab Atkins Jr. wrote:

> #4 and #5 are, I think we all recognize, quite necessary.  It's silly
> that CSS still doesn't have this ability.  The margin:0 auto trick is
> cute, but annoying in multiple ways - you have to either specify the
> top/bottom margin or explicitly break it out into a margin-left and
> margin-right declaration, you need to give the container a definite
> width or else trigger shrinkwrap behavior by setting it as
> display:table (this will be fixed by the new width values, of course),
> and it doesn't work at all for centering multiple things.  Vertical
> alignment doesn't work *at all* without a silly hack (abspos it,
> top:50%, margin-top: -[box height here]) that requires a definite
> height.
> 
> We really need to solve this.  People have been agitating about it for *years*.

I couldn't agree more.

> [...]
> #2 is tricky.  There's the obvious problem that it can cause circular
> dependencies.  These can be tracked and broken, but then we'd have to
> decide what exactly to do.  We already have the table-* display types
> that can cause this in particular circumstances, and I've got some
> ideas to generalize that somewhat in a more flexible way, which I'll
> write up before the ftf.  I also believe that Template Layout will
> address many of these problems, since template ::slots *are* sized and
> positioned relative to each other, as specified by the template
> strings.

I believe flex units would also help out with this.

> However, I have a use-case that I ran into and which was very annoying
> which can't be solved by this.  I had a page of multiple data tables,
> separated by headings.  All the tables have the exact same columns, so
> I'd like for them all to have the same column widths.  I can't do that
> currently, or with any existing suggested method.  I still don't want
> the suggested "be as wide as this other element", though, as I want
> *all* the cells to participate in the table layout - essentially I'd
> like them to be one big table that just happens to be visually chopped
> up with headings inserted between.  I can produce an example page for
> this if requested.

I know exactly what you mean. I run into this pretty often, and sometimes end up making one big table, with the headings inside a column spanning transparent row. But it's pretty ugly, and makes things like 'tr:last-child' less meaningful without explicitly adding multiple tbodies.

Received on Wednesday, 17 March 2010 16:00:09 UTC