Golang Tutorials - Learn Go Programming with Easy Step-by-Step Guides

Explore comprehensive Golang tutorials for beginners and advanced programmers. Learn Go programming with easy-to-follow, step-by-step guides, examples, and practical tips to master Go language quickly.

Bs5 Grid System in Bootstrap

Bs5 Grid System in Bootstrap

Absolutely! Here's a comprehensive yet clear overview of the Bootstrap 5 Grid System — the backbone of responsive layouts.


? Bootstrap 5 Grid System

Bootstrap’s grid system is a flexbox-based 12-column system that helps create responsive layouts efficiently.


1. Containers

Grid content must be wrapped in a container:

  • .container — fixed-width, responsive

  • .container-fluid — full-width (100% viewport width)

  • .container-{breakpoint} — containers that are fluid until a specific breakpoint

<div class="container">  <!-- grid rows here --></div>

2. Rows

Rows wrap columns and clear the horizontal floats:

<div class="row">  <!-- columns here --></div>
  • .row uses display: flex with negative margins to align columns.


3. Columns

Columns hold your content and use .col-* classes.

  • The grid has 12 equal-width columns per row.

  • Columns can be sized using numbers (.col-4 for 4/12 width).

  • Columns automatically wrap to next line if total exceeds 12.


4. Breakpoints & Responsive Columns

Bootstrap’s grid is responsive with these breakpoints:

BreakpointClass prefixMinimum viewport width
Extra small.col-None (default)
Small.col-sm-? 576px
Medium.col-md-? 768px
Large.col-lg-? 992px
Extra large.col-xl-? 1200px
XXL.col-xxl-? 1400px

You can mix and match breakpoint classes:

<div class="row">  <div class="col-12 col-md-6 col-lg-4">Responsive column</div>  <div class="col-12 col-md-6 col-lg-8">Responsive column</div></div>

5. Auto-layout Columns

If you omit the number, columns share equal width automatically:

<div class="row">  <div class="col">Auto 1</div>  <div class="col">Auto 2</div>  <div class="col">Auto 3</div></div>

6. Offsets

Shift columns to the right using .offset-* classes:

<div class="row">  <div class="col-4 offset-4">Centered column</div></div>

7. Ordering Columns

Change column order with .order-* classes:

<div class="row">  <div class="col order-3">Third visually</div>  <div class="col order-1">First visually</div>  <div class="col order-2">Second visually</div></div>

8. Gutters (Spacing Between Columns)

  • Default gutters (horizontal and vertical spacing) exist between columns.

  • Control gutters with .g-* classes or .gx-* (horizontal), .gy-* (vertical):

<div class="row g-0"> <!-- No gutters -->  <div class="col-6">No gutter col 1</div>  <div class="col-6">No gutter col 2</div></div>

9. Nesting

You can nest rows inside columns for complex layouts:

<div class="row">  <div class="col-8">    Parent column    <div class="row">      <div class="col-6">Nested col 1</div>      <div class="col-6">Nested col 2</div>    </div>  </div>  <div class="col-4">Sidebar</div></div>

Summary Example

<div class="container">  <div class="row">    <div class="col-12 col-md-8">Main content</div>    <div class="col-6 col-md-4">Sidebar</div>  </div></div>

If you'd like, I can help you build custom responsive layouts, show grid utilities in action, or demonstrate grid combined with other Bootstrap components!

Disclaimer for AI-Generated Content:
The content provided in these tutorials is generated using artificial intelligence and is intended for educational purposes only.
html
docker
php
kubernetes
golang
mysql
postgresql
mariaDB
sql