W3C home > Mailing lists > Public > www-style@w3.org > March 2013

RE: The :min-width/:max-width pseudo-classes

From: François REMY <francois.remy.dev@outlook.com>
Date: Sat, 30 Mar 2013 22:19:24 +0100
Message-ID: <DUB120-W22EBBD99F3BE9C989D2F36A5DC0@phx.gbl>
To: Tab Atkins Jr. <jackalmage@gmail.com>
CC: Elliott Sprehn <esprehn@gmail.com>, Boris Zbarsky <bzbarsky@mit.edu>, www-style list <www-style@w3.org>
Thanks Tab, I think I understand the issue better. So, the main issue is the selector/layout relationship. I agree with you, you can't escape this at some point as soon as you want @media/min-width. I think the WG objective is to minimize the impact as much as possible while maintaining much of the benefits.

> Yes, layout of a child depending on layout of a parent is fine, and
> extremely common.
> The problems here are (1) selectors depending on layout, so that both
> selector resolution and layout have to be multipass, 

It's either the case for <iframe>s already or the tricks used for <iframe>s should be replicated to avoid this. 

> Limiting the selector to only depending on ancestors helps (2), but
> Boris points out that this may not be enough - we may need to limit it
> to only the nearest viewport. I think this is likely to be a
> perfectly acceptable limitation, as the whole point of having a
> viewport is that the children don't need to worry about the outside
> world.

This would be perfectly acceptable, I think. The only thing is that we should review the use cases carefully because if ':min-width' only applies to the nearest viewport, people are going to write selectors like ':min-width(480px) nav' because they know ':min-width' can't apply to a parent viewport of the nearest local viewport. That's elegant if you want my point of view but it prevents extending ':min-width' to more elements thereafter (this is probably a good idea anyway but we have to think about it). 

The other option would be to use an at-rule but it prevents use-cases like ".toolbar:min-width(500px) { background: url('toolbar.png'); }" (ie: setting layout-unrelated properties, similarly to what you can do for ':visited' for links) and this is a bit more ugly in my opinion.

> min-content doesn't require a real layout - you do need to query the
> children for their min-content sizes, but that's determined without
> any "real" layout going on. You can also cache the sizing
> information.

Still, it requires to compute the length of the longest word, something which requires getting the font right, and probably taking things like ::first-letter and ::first-line in account, plus margin & paddings. But yeah, I can see how it doesn't require a full layout (but it can be pretty heavy in some cases).

Received on Saturday, 30 March 2013 21:19:51 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:09 UTC