Need help with Order for display flex
Order is used to change to position of the child elements in a flex box. i tried the same but its not quite the same. there is a main div location-jokes container which has
display:flex
and flex-direction:column
properties . Now i wanted to reverse the order of childs so i used following order to change the position, the child position is changed but the grandchildren position is affected by this, how to fix it, so only child position is moved ? i have attached the code and ss for better understanding
https://codepen.io/avinash-tallapaneni/pen/ExRomwX3 Replies
if you look at the outline after order is applied grandchildrens are getting affected
It's affecting the grandchildren because your CSS tells it to. You're using the
Descendant combinator
selector:
Note the space (
) between the two identifiers. What you want is the Child combinator
:
Note the >
: that says "only direct children".
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors#combinatorsoh. it worked