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: Fri, 22 Mar 2013 01:35:42 +0100
Message-ID: <DUB002-W96BC8C10C77DF80BC1C933A5D40@phx.gbl>
To: Tab Atkins Jr. <jackalmage@gmail.com>
CC: Elliott Sprehn <esprehn@gmail.com>, "www-style@w3.org" <www-style@w3.org>
> Oh! So your idea is that a :max-width() pseudo would, regardless of
> where in the selector it appears, match based on the nearest viewport
> element of the selector's subject?

Not exactly. I'm just saying that if the layout of the element hasn't been calculated in a previous pass, the pseudo-class doesn't match. And the condition to which the layout of the target element has been computed in a previous pass is that it should be the nearest parent viewport of the element to be matched, or an ancestor.

So :min-width() consider the width of the element it's applied on, but only if the width of the element is known. If it's not, the pseudo-class do not match.

The only downside of this approach is that the elements that :min-width can match on depends on the final element to be matched. If you have three nested divs, and the middle one is a local viewport, then ":min-width(...) > div" will match no element while ":min-width(...) > div > div" will match the third div. It does however make sense because that third div lays in another layout sub-tree but it can be counter-intuitive at the beginning. 		 	   		  
Received on Friday, 22 March 2013 00:36:14 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:07 GMT