Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTrent Christofferson
18,846 PointsDoes :nth-child work with flexbox ordering?
When you rearrange the order of something with flexbox does :nth-child follow flexbox rules or does it just go by html?
1 Answer
Steven Parker
231,269 PointsThe "nth-child" pseudo-class targets elements based on DOM order.
Flexbox ordering only changes the visual arrangement of items, it does not affect how they are arranged in the DOM tree. So if you use order
to move items around, it will not change their "nth-child" number.
Trent Christofferson
18,846 PointsTrent Christofferson
18,846 Pointsthanks!