So, spec determines that the elements are drawn "in tree order" for the stream, positional elements with the same level of block or float and identical z-index . This, of course, means that the last declared HTML in the markup is drawn on top. But what if we want this order to be canceled for arbitrary children in a specific container?
For example, let's say we have an indefinite number of overlapping float div in the parent div :
__________________________________ | _________________________ | | | samant| allis| rachael |... | | |_______|______|_________|... | |_________________________________|
So we want it to look like this:
__________________________________ | _________________________ | | | samantha |lison |chael |... | | |__________|______|______|... | |_________________________________|
jsfiddle
Is there another way to achieve this with css? If not, what is the most efficient and safest way to achieve this functionality with javascript for arbitrary children?
Questions were asked earlier for similar functions, but not specifically for use in a general sense with an arbitrary number of children. See here and here .
source share