


Can Bootstrap\'s Push/Pull Classes Reorder Equal-Sized Columns on Mobile Devices?
Reordering Bootstrap Columns with Push/Pull: Limitations and Alternative Approaches
When dealing with columns of equal size (.col-*-12), a common query arises regarding the feasibility of changing their order using Bootstrap's push and pull directives. The purpose of this query is to understand if it's possible to reverse the placement of two such columns on devices with mobile screen sizes.
Limitations of Push/Pull
Unfortunately, it's not possible to reorder .col-*-12 columns using push and pull classes. This is due to the fact that the sum of these columns exceeds the predefined grid size of 12 columns, as specified by the @grid-columns variable in Bootstrap.
Alternative Approaches
To achieve the desired reordering, consider the following alternatives:
1. Modifying HTML Structure and Using Push/Pull for Larger Screens:
Rearrange the columns within the HTML and apply push/pull classes to achieve the desired order on larger screens. For instance:
<code class="html"><div class="row"> <div class="col-xs-12 col-sm-6 col-sm-push-6"> <p>test2</p> </div> <div class="col-xs-12 col-sm-6 col-sm-pull-6"> <p>test1</p> </div> </div></code>
2. Using CSS Transforms to Reverse Column Order on Mobile:
Apply the following CSS to reverse the ordering of vertically stacked columns on devices with a screen size of 767px or less:
<code class="css">@media (max-width: 767px) { .row.reorder-xs { transform: rotate(180deg); direction: rtl; /* Fix horizontal alignment */ } .row.reorder-xs > [class*="col-"] { transform: rotate(-180deg); direction: ltr; /* Fix horizontal alignment */ } }</code>
Note that this approach requires the use of HTML class specific to the desired columns to be reordered.
The above is the detailed content of Can Bootstrap\'s Push/Pull Classes Reorder Equal-Sized Columns on Mobile Devices?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

It's out! Congrats to the Vue team for getting it done, I know it was a massive effort and a long time coming. All new docs, as well.

With the recent climb of Bitcoin’s price over 20k $USD, and to it recently breaking 30k, I thought it’s worth taking a deep dive back into creating Ethereum

I had someone write in with this very legit question. Lea just blogged about how you can get valid CSS properties themselves from the browser. That's like this.

The other day, I spotted this particularly lovely bit from Corey Ginnivan’s website where a collection of cards stack on top of one another as you scroll.

I'd say "website" fits better than "mobile app" but I like this framing from Max Lynch:

There are a number of these desktop apps where the goal is showing your site at different dimensions all at the same time. So you can, for example, be writing

If we need to show documentation to the user directly in the WordPress editor, what is the best way to do it?

Questions about purple slash areas in Flex layouts When using Flex layouts, you may encounter some confusing phenomena, such as in the developer tools (d...
