Bootstrap Cheat Sheet
This cheat sheet condenses the most frequently used Bootstrap 5 classes into a single scannable reference you can return to while building pages.
Bootstrap Cheat Sheet Overview
Rather than introducing new concepts, this lesson organizes the classes covered throughout the course—grid, spacing, colors, flex, display, and components—into quick-reference tables grouped by category, so you can look up a class without searching back through individual lessons.
Keep this page bookmarked as a working reference during development; it's designed to answer 'what's that class called again?' faster than searching the full official documentation.
| Concept | Description | Common Usage |
| Grid quick reference | container, row, col-* naming pattern | Fast lookup while building layouts |
| Spacing quick reference | m-*/p-* scale and directional suffixes | Fast lookup while adjusting spacing |
| Color quick reference | text-*/bg-*/border-* theme names | Fast lookup while applying theme colors |
| Flex/display quick reference | d-flex, justify-content-*, align-items-* | Fast lookup while building flex layouts |
| Component quick reference | btn, card, modal, navbar class names | Fast lookup while assembling UI components |
Bootstrap Cheat Sheet Example
<!-- Grid -->
<div class="container"><div class="row"><div class="col-md-6">...</div></div></div>
<!-- Spacing -->
<div class="mt-3 mb-4 px-2">...</div>
<!-- Colors -->
<div class="bg-primary text-white border border-dark">...</div>
<!-- Flex -->
<div class="d-flex justify-content-between align-items-center gap-2">...</div>
These four snippets summarize the most reused patterns from the grid, spacing, colors, and flex lessons in one place, intended purely as a quick copy-paste starting point rather than a full explanation—refer back to each dedicated lesson for the complete picture.
Top 10 Bootstrap Cheat Sheet Examples
These are ten of the highest-frequency classes worth memorizing above all others.
| # | Example | Syntax |
| 1 | Container | <div class="container">...</div> |
| 2 | Row and column | <div class="row"><div class="col-md-6">...</div></div> |
| 3 | Margin bottom | <div class="mb-3">...</div> |
| 4 | Primary button | <button class="btn btn-primary">...</button> |
| 5 | Flex center | <div class="d-flex justify-content-center align-items-center">...</div> |
| 6 | Text color | <p class="text-muted">...</p> |
| 7 | Background color | <div class="bg-light">...</div> |
| 8 | Responsive hide/show | <div class="d-none d-md-block">...</div> |
| 9 | Card component | <div class="card p-3">...</div> |
| 10 | Form control | <input class="form-control"> |
Popular Real-World Bootstrap Cheat Sheet Examples
These are common quick-reference lookups developers return to most often while building pages.
| Scenario | Pattern |
| Starting any new layout | <div class="container"><div class="row">...</div></div> |
| Adding standard spacing | <div class="mb-3 p-3">...</div> |
| Building a button group | <div class="btn-group"><button class="btn btn-outline-secondary">A</button></div> |
| Centering anything with flex | <div class="d-flex justify-content-center align-items-center">...</div> |
| Making an image responsive | <img class="img-fluid rounded" src="a.jpg" alt="..."> |
| Styling a status message | <div class="alert alert-success">Saved</div> |
| Wiring up a modal | <button data-bs-toggle="modal" data-bs-target="#m">Open</button> |
| Wrapping a wide table | <div class="table-responsive"><table class="table">...</table></div> |
Best Practices
- Use this cheat sheet as a quick lookup, not a replacement for understanding each concept's full lesson.
- Keep the class naming patterns (property-breakpoint-size) in mind rather than memorizing every individual class.
- Cross-reference the official Bootstrap documentation for the exact version you're using when in doubt.
- Bookmark this page alongside your project's own internal conventions document.
- Revisit the cheat sheet periodically as you learn new components to reinforce recall.
- Use it during code review to quickly verify a teammate used the conventional class name for a pattern.
- Update your personal notes if your project extends Bootstrap with custom utility classes.
Common Mistakes
- Treating the cheat sheet as a complete substitute for understanding how each utility category actually works.
- Forgetting that some classes require a specific Bootstrap version and may differ from older tutorials.
- Copying class combinations without checking whether they fit the actual layout context (like columns needing a row).
- Not verifying component-specific requirements, like required data-bs-* attributes, from the cheat sheet alone.
- Relying on memory instead of double-checking exact class names for less frequently used utilities.
- Skipping the accessibility attributes that some quick-reference snippets omit for brevity.
Quick Reference Table
A condensed table of the highest-frequency Bootstrap 5 classes grouped by category, for fast lookup while coding.
| Category | Class Examples | Purpose |
| Layout | container, row, col-md-6 | Structural page layout |
| Spacing | m-3, p-2, mt-4, gap-3 | Margin, padding, and gap control |
| Color | text-primary, bg-success, border-danger | Applying the theme color palette |
| Flex | d-flex, justify-content-between, align-items-center | Flexbox alignment and distribution |
| Display | d-none, d-md-block, d-grid | Responsive visibility and rendering mode |
| Components | btn btn-primary, card, navbar, modal | Pre-styled UI building blocks |
| Forms | form-control, form-label, form-check | Styled form fields and controls |
Key Takeaways
- This cheat sheet consolidates the most frequently used classes from the entire course.
- Grid, spacing, colors, flex, and components each have a small set of classes worth memorizing first.
- The cheat sheet is a lookup aid, not a substitute for understanding the underlying concepts.
- Cross-referencing official docs remains important for version-specific details.
- Reinforcing recall by revisiting the cheat sheet speeds up everyday development.
Pro Tip
Print or pin this cheat sheet next to your editor for the first few weeks of a new Bootstrap project—muscle memory for these class names builds quickly once you stop needing to search for them every time.