search
HomeWeb Front-endBootstrap TutorialWhy does bootstrap only have 12 columns by default?

bootstrap can only default to 12 columns because 12 is the least common multiple of the numbers "1, 2, 3, 4, 6", so the 12-column grid system is relatively flexible and supports dividing a row into 1 column, 2 columns, 3 columns, 4 columns, 6 columns.

Why does bootstrap only have 12 columns by default?

The operating environment of this tutorial: Windows 7 system, bootstrap3 version, Dell G3 computer.

Why does Bootstrap have 12 columns by default?

I was asked a question today: “Have you ever wondered why Bootstrap has 12 columns by default?” I wonder why the default setting is 12 columns. I vaguely think it’s because the layout is more convenient. Commonly divided into 2 blocks, 3 blocks, and 4 blocks, which can be easily divided.

Since we have a hypothesis, we still need to prove it.

Google search for a while.

Contrary to the question’s parenthetical, Bootstrap was always at 940px wide, and not 960px, even with the original 16 columns. With the switch to 12 columns in Bootstrap 2, we wanted to simplify the overall grid (16 columns is right on the edge of enough granularity) and make it easier to get three columns.

The general meaning is that it was originally 16 columns, but later changed to 12 columns to make it easier to arrange three columns.

Okay, so here comes the question, why was 16 columns designed before?

Go on Google.

16-columns has long been the go-to grid for designers and developers, but we’ve noticed a shift to 12- and 24-columns to offer a more flexible layout. And they’re right for doing so—gridded layouts work best with an odd number of columns (you often see three columns, but four or six are not that popular).

This is a 2011 discussion in Bootstrap's github bug list. The title is asking why 16 columns were used instead of 24 columns. It turns out that there are 24 columns before the 16 columns. Roughly speaking, 16 columns is the first choice for developers and designers, but 12 or 24 columns can be more flexible. Among them, the layout of odd columns is more common. For example, you can often see the layout of three columns.

Here, I don’t know why 16 columns is the first choice for developers and designers. But later I mentioned that the three-column layout is more common, and it is indeed the case. For example, the homepage of CSDN has a three-column layout. It is not very convenient to divide 3:1 or 3:2 with 16 columns.

And 12 is the least common multiple of 1, 2, 3, 4, and 6, so the 12-column grid system is relatively flexible and supports dividing a row into 1 column, 2 columns, 3 columns, 4 columns, and 6 columns. . If you want to support 5 columns, then the least common multiple of 1, 2, 3, 4, and 5 is 60, and the number 60 is obviously too large for the grid system.

Recommended: "

bootstrap video tutorial

"

The above is the detailed content of Why does bootstrap only have 12 columns by default?. For more information, please follow other related articles on the PHP Chinese website!

Statement
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
How to use Bootstrap spinners for loading statesHow to use Bootstrap spinners for loading statesAug 26, 2025 am 04:45 AM

Bootstrapspinnersareusedtoindicateloadingstatesinwebapplications.1.Therearetwotypes:theborderspinner,whichrotates,andthegrowspinner,whichscaleswithapulsingeffect,bothrequiringrole="status"andavisuallyhidden"Loading..."messageforac

How to add icons to input fields in BootstrapHow to add icons to input fields in BootstrapAug 26, 2025 am 01:46 AM

To add icons to the Bootstrap input box, you need to combine the input group and the icon library; 1. First introduce the icon library through CDN, such as BootstrapIcons or FontAwesome; 2. Use Bootstrap's input-group component to wrap the input box and add icons in the input-group-text; 3. If using BootstrapIcons, insert the icon; 4. The icon can be placed on the left or right side of the input box, the left side is used to prompt the input type, and the right side can be used to operate the button; 5. Support adding icons on both sides at the same time; ensure that the icon library is loaded correctly, and add aria-label to the key icons to improve accessibility, and ultimately achieve aesthetics and

How to use Bootstrap scrollspy with fixed navigationHow to use Bootstrap scrollspy with fixed navigationAug 25, 2025 am 09:54 AM

To make Bootstrap's Scrollspy work properly with the fixed navigation bar, you must first make sure that the page structure contains chapters with ID and corresponding links. 1. Set the body's data-bs-spy="scroll", data-bs-target="#navbar" and data-bs-offset="70" to enable scrolling listening and correct offset; 2. Make sure that the ID of each content area exactly matches the href value of the navigation link; 3. Set padding-top for the body through CSS to avoid the content being blocked by fixed navigation; 4. Optionally use

How to optimize Bootstrap for performanceHow to optimize Bootstrap for performanceAug 25, 2025 am 03:43 AM

UseacustomBootstrapbuildbyimportingonlynecessarySasscomponentstoreducefilesizeby50%ormore.2.MinifyCSSwithtoolslikecssnanoandremoveunusedclassesusingPurgeCSS,whilebeingcautiousofdynamicallyinjectedclasses.3.OptimizeCSSdeliverybyinliningcriticalstylesa

How to create a responsive timeline in BootstrapHow to create a responsive timeline in BootstrapAug 25, 2025 am 02:42 AM

UseBootstrap’sgridandcardstostructurethetimelinewithalternatingleft-rightlayoutondesktopthatstacksonmobile.2.AddcustomCSStocreateacentralverticaltimelinelineandcircularmarkers,adjustingpositionformobileresponsiveness.3.Ensureaccessibilitywithsemantic

How to create a product quick view modal in BootstrapHow to create a product quick view modal in BootstrapAug 25, 2025 am 01:54 AM

First, introduce the CSS and JS files of Bootstrap5, and use CDN links to quickly build the environment; 2. Create a product card grid, add the "QuickView" button to each card, and store the JSON string of product information through the data-product attribute; 3. Build the HTML structure of the model box, set the modal-lg class to obtain a larger display area, and use the Bootstrap grid system to realize the layout of pictures and details side by side; 4. Use JavaScript to listen to the show.bs.modal event, dynamically analyze the data-product data on the button and fill it into the corresponding elements of the modal box, real-time update of the content; 5. Optional enhancement

How to create a mobile-first layout in BootstrapHow to create a mobile-first layout in BootstrapAug 24, 2025 am 07:32 AM

Bootstrap adopts a mobile-first design by default. The key to creating a mobile-first layout is to use its responsive grid system and breakpoint classes; 1. Use .container or .container-fluid to wrap content, and use .row and .col-classes to build the basic layout internally; 2. Set the default style for small screens (col-12 without prefixes, etc.), and then gradually enhance the display effect of the large screen through breakpoint classes such as col-md-, col-lg-, etc.; 3. Use navbar-expand-lg to cooperate with navbar-toggler to achieve mobile folding and large screen expansion; 4. Add img-fluid class to the picture to adapt to the size; 5. Use fs-, p-

How to use the Bootstrap grid for complex layoutsHow to use the Bootstrap grid for complex layoutsAug 24, 2025 am 05:20 AM

Bootstrap's mesh system builds complex and responsive layouts by flexibly using nested, responsive classes, Flexbox tools and spacing utilities. 1. The grid is based on Flexbox, and uses d-flex, justify-content-, align-items- and other classes to achieve alignment and layout control; 2. Create multi-level layouts by nesting .row in .col, suitable for sidebar or card internal structure; 3. Use responsive classes such as xs, sm, md to define layout changes on different devices, and adjust the content order through order-*; 4. Combine g-4, mx-auto equal-spacing classes and auto-layout to achieve fine layout, and use w-10

See all articles

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Hot Topics