"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > How to Extend Bootstrap 3 Rows Beyond the 12-Column Limit?

How to Extend Bootstrap 3 Rows Beyond the 12-Column Limit?

Published on 2024-12-11
Browse:295

How to Extend Bootstrap 3 Rows Beyond the 12-Column Limit?

Customizing Bootstrap 3 to Break the 12-Column Limit in Rows

Problem

By default, Bootstrap 3 forces columns greater than 12 units to stack vertically due to their "float: none" behavior. This limitation can hinder dynamic layouts where multiple content blocks may be added to a row.

Solution

To break this restriction, you can apply custom CSS overrides to override Bootstrap's behavior and allow rows to accommodate more than 12 columns. Here's how:

/* col-xs float fix for large column groups */
.large-group .col-xs-12 {
  float: left;
}

/* col-sm float fix for large column groups */
@media (min-width: 768px) {
  .large-group .col-sm-12 {
    float: left;
  }
}

/* col-md float fix for large column groups */
@media (min-width: 992px) {
  .large-group .col-md-12 {
    float: left;
  }
}

/* col-lg float fix for large column groups */
@media (min-width: 1200px) {
  .large-group .col-lg-12 {
    float: left;
  }
}

Implementation Example

col 9

col 3

col 12

Rationalization

Although Bootstrap's default behavior ensures that rows remain visually consistent, it may not always be suitable for dynamic or space-constrained layouts. This customization enables greater flexibility and responsiveness in such situations.

Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3