Bulma: Way to configure stack orders

Created on 18 Jan 2017  路  6Comments  路  Source: jgthms/bulma

Is there any way to define stack orders on mobile?

For example, take a look at this

https://jsbin.com/cipayeqepi/edit?html,output

It's horizontal on wide screens, when it shrinks "1" is on top.

How can I define an order to make "2" on top in this case.

I also tried to use order
https://jsbin.com/yewifavoyo/edit?html,css,output

Most helpful comment

Ah, OK. That would be something like this?
You could write it cleaner using mixins though.

<div class="columns reverse-row-order">
  <div class="column box">
    1
  </div>
  <div class="column box">  
    2
  </div>
</div>
@media screen and (max-width: 769px) {
  .reverse-column-order {
    display: flex;
    flex-direction: column-reverse;
  }
}

https://jsbin.com/xovivuyome/edit?html,css,output

All 6 comments

I think you can archive what you want using flex-direction: row-reverse.
It's the opposite of changing the order on mobile. But it's more intuitive.

Make "2" on top from the begining, and make them reverse in horizontal on wide screens.

<div class="columns reverse-row-order">
  <div class="column box">
    2
  </div>
  <div class="column box">  
    1
  </div>
</div>
.reverse-row-order {
  flex-direction: row-reverse;
}

https://jsbin.com/fahoqomika/edit?html,css,output

Thanks for the demo.I appreciate that.

But, I was wondering if I can achieve the same result without changing a html structure

Ah, OK. That would be something like this?
You could write it cleaner using mixins though.

<div class="columns reverse-row-order">
  <div class="column box">
    1
  </div>
  <div class="column box">  
    2
  </div>
</div>
@media screen and (max-width: 769px) {
  .reverse-column-order {
    display: flex;
    flex-direction: column-reverse;
  }
}

https://jsbin.com/xovivuyome/edit?html,css,output

That's perfect. Thanks alot.

Just out of curiosity, what if you have elements like this
~~~

1
2
3
4

~~~

and you want to order them like this on mobile

~~~

3
2
1
4

~~~
How would you do it?

Like this?

https://jsbin.com/dukihociyu/1/edit?html,css,output

And can you close the issue if you solved your question.

FYI there's some major typos on this. Final code should be:

<div class="columns reverse-row-order">
  <div class="column box">
    2
  </div>
  <div class="column box">  
    1
  </div>
</div>
@media only screen and (min-width: 769px) {
  .reverse-row-order {
    display: flex;
    flex-direction: row-reverse;
  }
}

Just some inconsistent use of "row" and "column", as well as forgetting to reorder the columns in the markup. Works great tho!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NurdinDev picture NurdinDev  路  3Comments

jaredreich picture jaredreich  路  3Comments

dotMastaz picture dotMastaz  路  3Comments

swamikevala picture swamikevala  路  3Comments

swthate picture swthate  路  3Comments