Re: CSS Referencing

On 5 January 2012 14:57, Oliver St. John <osj@cbord.com> wrote:
> This kind of referencing is something I have been wanting pretty much ever since I first sat down and typed out 'body{}'. There would have to be some limitations involved such that you're not trying to (for example) set the height of #specificDiv as a reference to .variedClass when divs in variedClass have different heights. (Of course, that only applies when you're setting absolute values... being able to set height.thisdiv to (height.otherdiv/2) would be pretty sweet as well...) Perhaps it would be as simple as requiring that the style being referenced have the property explicitly declared (so you can only reference .variedClass if .variedClass has a height declaration), but there may be use cases outside of this.
>
> However, this and flexbox are probably the last two things left on my wish list, so I would be thrilled to see them implemented.

Grid layout will allow this, and more besides, in a more
understandable and toolable way.

Rather than having two elements reference each other, which creates a
circular reference problem, you can instead just place them both
within the same grid row and tell them to vertically stretch to fill.
The row will expand to contain the naturally largest of the two
elements, whilst also keeping them both the same size. That way, you
can remove either of the elements without the layout breaking, and add
an arbitrary number of extra elements that can also size similarly.

Thanks,

Jon

Received on Thursday, 5 January 2012 17:02:50 UTC