Bulma: Change stack order of columns

shigg picture shigg · Jan 18, 2017 · Viewed 12.6k times · Source

How can I change the stack order of columns on mobile or tablet?

For example, the code below shows elements horizontally on wide screens, but when it's shrinked I want 2 to be on top. I don't want to change the html structure to do it.

The example is below:

Answer

Mohammad Usman picture Mohammad Usman · Jan 26, 2017

As of the current bulma version v0.3.1, there is no feature for the changing the order of columns.

However, you can define custom styles to change the order for mobile, tablet or whatever resolution that you want.

You can define a custom class .reverse-columns for example and add it on parent with following styles:

@media(max-width: 767px) { /* <== You can change this break point as per your  needs */
  .reverse-columns {
    flex-direction: column-reverse;
    display: flex;
  }
}

@import url("https://cdnjs.cloudflare.com/ajax/libs/bulma/0.3.1/css/bulma.css");

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