Quantcast
Channel: Active questions tagged flexbox - Stack Overflow
Viewing all articles
Browse latest Browse all 1675

How can I reverse all the elements of a flexbox in CSS?

$
0
0

I'm trying to sort elements of a flexbox from the last to the first.

I tried using flex-direction: row-reverse; but it only reverses the lines, not the whole container.

The result:

the result

It sorts like 3-2-1-(...)-9-8-7, what I want is 9-8-7-(...)-3-2-1*

How can I reverse all elements?

.container {  display: flex;  flex-wrap: wrap;  height: 10rem;  flex-direction: row-reverse;}.container .item {  height: 30%;  width: 30%}
<div class="container"><div class="item">1</div><div class="item">2</div><div class="item">3</div><div class="item">4</div><div class="item">5</div><div class="item">6</div></div>

Viewing all articles
Browse latest Browse all 1675

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>