We have flex container with 2 child elements.
When we resize window, and one of flex item wraps, we have each element on its own row.
Is it any selector like :when-alone-in-row
?
.flex-parent {flex-flow: row wrap}
.flex-child
.flex-child
We have flex container with 2 child elements.
When we resize window, and one of flex item wraps, we have each element on its own row.
Is it any selector like :when-alone-in-row
?
.flex-parent {flex-flow: row wrap}
.flex-child
.flex-child
No, there is no selector similar to :when-alone-in-row
.
However, when you want to select the first and last elements from a group of siblings (which would be the case here since you're dealing with only two flex items), you can use the :first-child
and :last-child
pseudo classes.
Of course, the styles applied by these selectors will work even when both items are on the same line, unless they're applied in a media query.
If it always collapses at the same screen size you could use media queries to adjust the styles when they are on their own row.
If not, it might be worth also using media queries for the collapsing, so you can better control your rows / columns.