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

Re: CSS Referencing

From: Jon Rimmer <jon.rimmer@gmail.com>
Date: Thu, 5 Jan 2012 17:02:09 +0000
Message-ID: <CA+ZDCiB0+NsEy0AOscrudFciWje8Af5cGw5JfosNUwYN_yA3uQ@mail.gmail.com>
To: "Oliver St. John" <osj@cbord.com>
Cc: "www-style@w3.org" <www-style@w3.org>
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.


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

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:09 UTC