Home > Web Front-end > CSS Tutorial > How Can I Reorder Bootstrap 3 Columns on Larger Screens While Maintaining Mobile Layout?

How Can I Reorder Bootstrap 3 Columns on Larger Screens While Maintaining Mobile Layout?

Mary-Kate Olsen
Release: 2024-12-17 11:53:25
Original
559 people have browsed it

How Can I Reorder Bootstrap 3 Columns on Larger Screens While Maintaining Mobile Layout?

Changing Column Order in Bootstrap 3 Mobile Layout

You are working with a responsive layout using Bootstrap 3.x, consisting of two columns: a sidebar (3) and content (9). While the layout renders well on desktops:

navbar
[3][9]
Copy after login

On mobile, the order changes:

navbar
[3]
[9]
Copy after login

You want to maintain the order on mobile, with the content at the top.

Solution: Reordering Columns

The approach to reordering columns varies based on screen size. In this case, you cannot change the order on smaller screens. However, you can change it in larger screens.

Step 1: Change the Order of Columns

Change the order of your columns in the code:

<!-- Main Content -->
<div>
Copy after login
Copy after login

By default, this will display the main content first, even on mobile.

Step 2: Use col-lg-push and col-lg-pull

col-lg-push and col-lg-pull allow you to reorder columns in large screens. This is how you can display the sidebar on the left and the main content on the right in larger screens:

<!-- Main Content -->
<div>
Copy after login
Copy after login

By using this method, you can reorder the columns in large screens without affecting the layout on mobile.

The above is the detailed content of How Can I Reorder Bootstrap 3 Columns on Larger Screens While Maintaining Mobile Layout?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template