Cheatsheets

Bootstrap Cheatsheet

Use this Bootstrap cheatsheet to remember grid syntax, spacing utilities, buttons, cards, alerts, forms and navbars, plus the markup patterns that require Bootstrap CSS in your project.

Quick reference

Grid

Containercontainer
Rowrow
Columncol-md-6
Gapg-3

Spacing

Margin topmt-4
Paddingp-3
Horizontal marginmx-auto
Responsive spacingpy-3 py-md-5

Components

Buttonbtn btn-primary
Cardcard card-body
Alertalert alert-success
Form inputform-control

Visual patterns

Compare the syntax with a small rendered example so the reference is easier to scan and remember.

Grid

Bootstrap grids use containers, rows and columns.

Bootstrap markupBootstrap markup
<div class="container">
  <div class="row g-3">
    <div class="col-md-4">Column 1</div>
    <div class="col-md-4">Column 2</div>
    <div class="col-md-4">Column 3</div>
  </div>
</div>

Bootstrap classes require Bootstrap CSS in your project.

Live preview
colcolcol
Buttons

Button variants communicate action weight and state.

Bootstrap markupBootstrap markup
<button class="btn btn-primary">primary</button>
<button class="btn btn-outline-primary">Outline</button>

Bootstrap classes require Bootstrap CSS in your project.

Live preview
Cards and alerts

Use alerts for short status messages and cards for grouped content.

Bootstrap markupBootstrap markup
<div class="alert alert-primary">primary alert</div>
<div class="card">
  <div class="card-body">Card body text.</div>
</div>

Bootstrap classes require Bootstrap CSS in your project.

Live preview
primary alertCard title

Card body text.

Forms

Bootstrap form controls need labels just like plain HTML forms.

Bootstrap markupBootstrap markup
<label class="form-label" for="email">Email address</label>
<input id="email" class="form-control" type="email">
<button class="btn btn-primary">Submit</button>

Bootstrap classes require Bootstrap CSS in your project.

Live preview
Navbar

Bootstrap navbars group brand, links and mobile toggles.

Bootstrap markupBootstrap markup
<nav class="navbar navbar-expand-lg">
  <a class="navbar-brand" href="#">Brand</a>
  <button class="navbar-toggler">Menu</button>
</nav>

Bootstrap classes require Bootstrap CSS in your project.

Live preview
BrandDocsPricing

Learn the pattern

Short notes to help you decide when to use each pattern, avoid common mistakes and copy the examples with confidence.

When to use

  • Use Bootstrap when you want established components and grid conventions.
  • Use grid classes for fast responsive page structure.
  • Use component classes when Bootstrap CSS is already in the project.

Quick tips

  • Keep columns inside rows and rows inside containers.
  • Use responsive column classes to stack on mobile.
  • Copy Bootstrap markup together with the required classes.

Common mistakes

  • Using column classes outside a row.
  • Expecting Bootstrap markup to style itself without Bootstrap CSS.
  • Overriding too many Bootstrap rules instead of choosing simpler markup.

Best practices

  • Use Bootstrap utilities for spacing before custom CSS.
  • Keep labels on form controls for accessibility.
  • Prefer standard component patterns when speed matters.

Examples

CodeTwo-column layout
<div class="container py-5">
  <div class="row g-4">
    <div class="col-md-6">First</div>
    <div class="col-md-6">Second</div>
  </div>
</div>

Bootstrap FAQ

What is included in the Bootstrap cheatsheet?

Bootstrap Cheatsheet includes quick reference sections, practical examples, common mistakes, tips and links to related DevKitYard tools.

Is the Bootstrap cheatsheet interactive?

Yes. This cheatsheet includes visual examples with copyable code and lightweight controls where interaction helps explain the pattern.

When should I use this Bootstrap reference?

Use it when you need to recall syntax, compare common patterns or avoid mistakes without opening a long tutorial.

What should I use after reading this cheatsheet?

Use related DevKitYard tools such as HTML Formatter, CSS Beautifier when you need to format, validate, generate or inspect real output.