Skip to content
Advertisement

get last child when using Flex order Css

I am not able to detect last child when using flex order to rearrange divs. since I have arranged order of CSS with Order. its still getting the last child as per dom tree. items divs are dynamic. so we cant use nth-child. how should I get the last child when rearranged with order. There can be multiple items that need to be shown on top. I need CSS or js based solution. my code

JavaScript

Advertisement

Answer

If you’re really determined to do it like this, you can use javascript to find the last element that doesn’t have the orderFirst class and style that. This does seem like a mis-use of the order property, though.

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement