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 Basic in Bootstrap

Bs5 Grid Basic in Bootstrap

Sure! Here's a simple Bootstrap 5 Grid Basic overview — the foundation for creating responsive layouts.


? Bootstrap 5 Grid System Basics

Bootstrap 5 uses a flexbox-based 12-column grid system to create responsive layouts. The grid adapts to different screen sizes using breakpoints.


1. Container

Wrap your grid rows inside a container:

  • .container — fixed width, responsive

  • .container-fluid — full width, spans entire viewport

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

2. Row

Create a horizontal group of columns using .row:

<div class="row">  <!-- columns here --></div>

3. Columns

Use .col-* classes to specify column width.

  • Columns add up to 12 per row

  • If columns don’t add up to 12, remaining space is empty

Example:

<div class="row">  <div class="col-6">50% width</div>  <div class="col-6">50% width</div></div>

4. Responsive Columns

Use breakpoint prefixes to adjust columns at different screen sizes:

BreakpointClass prefixScreen width
Extra small.col-<576px (mobile)
Small.col-sm-?576px
Medium.col-md-?768px
Large.col-lg-?992px
Extra large.col-xl-?1200px
XXL.col-xxl-?1400px

Example — 2 columns on small screens, 4 columns on medium and up:

<div class="row">  <div class="col-sm-6 col-md-3">Column 1</div>  <div class="col-sm-6 col-md-3">Column 2</div>  <div class="col-sm-6 col-md-3">Column 3</div>  <div class="col-sm-6 col-md-3">Column 4</div></div>

5. Auto Layout Columns

If no number is specified, columns share space equally:

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

6. Nesting

You can nest rows and columns inside a column:

<div class="row">  <div class="col-8">    Column 8    <div class="row">      <div class="col-6">Nested col 6</div>      <div class="col-6">Nested col 6</div>    </div>  </div>  <div class="col-4">Column 4</div></div>

7. Offsets

Add space before columns using .offset-* classes:

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

? Quick Example

<div class="container">  <div class="row">    <div class="col-md-4">One-third width on md+</div>    <div class="col-md-8">Two-thirds width on md+</div>  </div></div>

If you want, I can show you advanced grid features like ordering, gutters, or responsive hiding/showing of columns!

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