- From: Andrew Fedoniouk <news@terrainformatica.com>
- Date: Tue, 14 Apr 2009 15:06:07 -0700
- To: "Tab Atkins Jr." <jackalmage@gmail.com>
- CC: Zack Weinberg <zweinberg@mozilla.com>, robert@ocallahan.org, David Hyatt <hyatt@apple.com>, www-style <www-style@w3.org>
Tab Atkins Jr. wrote: > I just realized this. Normal static-flow elements can only use flex > units within a container with the proper flow value. However, there's > no particular mention of whether or not that restriction applies to > abspos/fixpos elements. > > Does it? The restriction for normal elements is mostly to ensure that > we have a good way of figuring out what "unused space" means when a > dimension is unrestricted (like height for standard containers) so you > don't have an element pushing its container to infinite size. But > abspos/fixpos elements don't change the dimensions of their > positioning ancestor, so they should be able to use flexes in an > unrestricted manner. > > So, can you use flex units on abspos/fixpos elements? Position should > take flexes without a problem, as should margin. Padding still needs > wording to the effect of "if a height/width isn't explicitly defined, > there is no unused space in that direction". > > ~TJ > > > The reason of limitation of flexes use only in containers with flow defined is related to float elements. Here is an example: <p style="margin-top:*">Image on the right:<img style="float:right"></p> <p >Some text after it.</p> First you will replace text of the P and so you will find position for <img>. And as a last step of container measurement process you will process flexes as at this moment you know space that you can distribute in vertical direction. By shifting down first and next p (as of margin-top:*) you will change their position but <img> is already participated in text flow.... To be short flexes and float are conflicting to each other. The solution is explained in my document: all children of containers with 'flow' establish block formatting context as table cells do. About position:absolute|fixed. Yes, there is always block formatting context where such elements are replaced so flexes can be used "as is" as there is always a box where they live. left|top|bottom|right can accept flexes to position/align elements. That was explained in section 5.1 of http://www.terrainformatica.com/w3/flex-layout/flex-layout.htm For position:relative interpretation of flexes is as for position:static. left|top|bottom|right in flexes are ignored because for position:relative their meaning is different - offsets from static position. They do not use concept of containing box so nothing to flex about. -- Andrew Fedoniouk. http://terrainformatica.com
Received on Tuesday, 14 April 2009 22:06:49 UTC