The only condition for the existence of a flexible element is a child stream of the flexible container.
Please note: this means that a continuous run of text can be wrapped inside an anonymous flex element that does not match any element, and a child of the flex container may not be a flex element if any of the following
absolutely positioned
An absolutely positioned child of a flexible container is not involved in a flexible layout.
It has display: contents
The element itself does not generate any fields, but its children and Pseudo-elements still generate boxes as usual. For the purposes of generating and arranging boxes, an item should be processed as if it were replaced by its children and pseudo-elements in a document tree.
Instead, his children will become elements of flexibility (unless something from this list applies to them).
It has display: none
An element and its descendants do not generate any fields.
It has box-suppress: discard
The element does not generate any fields.
It has box-suppress: hide
The element generates fields as usual, but these fields do not participate in the layout in any way and should not be displayed.
Previously, if a child of a flex container had a display value that generated an anonymous parent, that parent became a flex element, not a child. This has changed, and now the child becomes an element of flexibility, and the parent is not created.
Also, yes, the display value should not prevent the element from being a flexible element.
Remember that flex elements are locked , so for example, inline-block becomes block , inline-table becomes table , inline-flex becomes flex , etc.
This means that regardless of the specified external role, the flexibility element will always be blocky.
In principle, the display property, when used in a flex element, is only useful for setting its internal display structure , for example. that you want the flex element to be a flex container for its contents.
A flex item sets a new formatting format for its content. The type of this formatting is determined by its display value, as usual. However, the flexible elements of flex-level boxes themselves are not block blocks: they are involved in container formatting contexts, and not in block formatting contexts.
(The terminology is slightly different, the Display specification indicates that the flex element is a block level in the sense of its external display role, the Flexbox specification says that it is not a block level in the sense that the formatting context in which it participates is not block)
Orientol
source share