Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Trent Christofferson
18,585 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
216,045 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,585 PointsTrent Christofferson
18,585 Pointsthanks!