Home > database >  Swapping Bootstrap column order in single row on mobile
Swapping Bootstrap column order in single row on mobile

Time:06-08

I have an issue with bootstrap columns and can't seem to resolve swapping the order on smaller devices. I don't want these to stack because they stay a single row on desktop, tablet and mobile. However, on Desktop and tablet I want the row in the default order like this:

Logo Menu Button

But on phones, I simply want the first two columns swapped, like so:

Menu Logo Button

How can I achieve a simple reverse of the columns while keeping the row?

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div >
    <div >
        <div >
        Logo
        </div>
        <div >
        Menu
        </div>
        <div >
        Button
        </div>
    </div>
</div>

Update: screenshot of current result enter image description here

CodePudding user response:

The issue is that Bootstrap-4 dropped the order-xs class as it is the default class. If you want to apply changes for only xs-classes you have to change the roder for all elements and use order-sm--class to correct the order at sm-width:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<div >
    <div >
        <div >
        Logo
        </div>
        <div >
        Menu
        </div>
        <div >
        Button
        </div>
    </div>
</div>

CodePudding user response:

<div >
    <div >
        <div >
        Menu
        </div>
       <div >
        Logo
        </div>
        <div >
        Button
        </div>
    </div>
</div>
  • Related