Responsiveness is a key! But, what exactly is that? Responsiveness means “being able to react quickly,” like a sports car whose responsiveness makes it fun to drive, or a “responding with emotion,” like the responsiveness of an audience at the concert of their all-time favorite singer. Okay, but how does it work on a website? A responsive website is one that automatically adapts to the size of the screen on which it is displayed. Cool right? Let’s see how to do it!
Bootstrap’s grid system allows up to 12 columns across the page.
If you do not want to use all 12 column individually, you can group the columns together to create wider columns:
Bootstrap’s grid system is responsive, and the columns will re-arrange depending on the screen size: On a big screen it might look better with the content organized in three columns, but on a small screen it would be better if the content items were stacked on top of each other.
Grid System Rules
- Rows must be placed within a
.container-fluid(full-width) for proper alignment and padding
- Use rows to create horizontal groups of columns
- Content should be placed within columns, and only columns may be immediate children of rows
- Predefined classes like
.col-sm-4are available for quickly making grid layouts
- Columns create gutters (gaps between column content) via padding. That padding is offset in rows for the first and last column via negative margin on
- Grid columns are created by specifying the number of 12 available columns you wish to span. For example, three equal columns would use three
- Column widths are in percentage, so they are always fluid and sized relative to their parent element
- The biggest difference between Bootstrap 3 and Bootstrap 4 is that Bootstrap 4 now uses flexbox, instead of floats. One big advantage with flexbox is that grid columns without a specified width will automatically layout as “equal width columns” (and equal height). Example: Three elements with
.col-smwill each automatically be 33.33% wide from the small breakpoint and up. Tip: If you want to learn more about Flexbox, you can read our CSS Flexbox Tutorial.
The Bootstrap 4 grid system has five classes:
.col-(extra small devices - screen width less than 576px)
.col-sm-(small devices - screen width equal to or greater than 576px)
.col-md-(medium devices - screen width equal to or greater than 768px)
.col-lg-(large devices - screen width equal to or greater than 992px)
.col-xl-(xlarge devices - screen width equal to or greater than 1200px)
The classes above can be combined to create more dynamic and flexible layouts.
Tip: Each class scales up, so if you wish to set the same widths for
md, you only need to specify
Base on those rules you can create something amazing:
Only your imagination can stop you!
Like for part 2!!
Bootstrap Grid System
Bootstrap's grid system allows up to 12 columns across the page. If you do not want to use all 12 column individually…