2026-08-14 09:42
Status:
Tags: Guide Web Development Front End Programming Lanuages Programming Concepts CSS Frameworks Learning Notes
CSS Frameworks & Spin-Offs
A quick-reference guide to CSS frameworks and tooling built on top of vanilla CSS — for use alongside your Common CSS Elements notes.
1. Tailwind CSS (Utility-First)
| Category | Common Classes | CSS Equivalent |
|---|---|---|
| Spacing | p-4, m-2, px-6, gap-4 | padding: 1rem, margin: 0.5rem, etc. |
| Sizing | w-full, h-screen, max-w-md | width: 100%, height: 100vh |
| Typography | text-lg, font-bold, text-center | font-size, font-weight, text-align |
| Color | bg-blue-500, text-gray-800 | background-color, color (from a preset palette) |
| Flexbox | flex, justify-between, items-center | display: flex, justify-content, align-items |
| Grid | grid, grid-cols-3, gap-4 | display: grid, grid-template-columns |
| Responsive | md:flex, lg:grid-cols-4 | Media query breakpoints as class prefixes |
| State | hover:bg-blue-700, focus:outline-none | :hover, :focus pseudo-classes |
Example — Card component:
<div class="max-w-sm rounded-lg shadow-md p-6 bg-white">
<h2 class="text-xl font-bold mb-2">Card Title</h2>
<p class="text-gray-600">Some description text goes here.</p>
<button class="mt-4 px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600">
Learn More
</button>
</div>When to Use Tailwind
| Use Case | Why Tailwind Fits |
|---|---|
| Custom, unique designs | No fighting pre-built component styles to override |
| Small bundle size needed | Purges unused classes at build time |
| Rapid prototyping with full control | Styling happens right in the markup, no context-switching |
| Design systems with consistent scale | Spacing/color/type scales are enforced by the config |
| Team comfortable with “utility class soup” | Trade-off: HTML gets verbose, but nothing is hidden in a stylesheet |
2. Bootstrap (Component-Based)
| Category | Common Classes | What It Provides |
|---|---|---|
| Grid system | container, row, col-md-6 | 12-column responsive grid |
| Buttons | btn, btn-primary, btn-outline-danger | Pre-styled button variants |
| Cards | card, card-body, card-title | Ready-made card component structure |
| Navbar | navbar, navbar-expand-lg, nav-link | Full responsive navigation component |
| Utilities | d-flex, text-center, mt-3 | Utility classes (spacing/display), similar in spirit to Tailwind but smaller in scope |
| Alerts/Badges | alert alert-warning, badge bg-secondary | Pre-styled feedback/status components |
Example — Card component:
<div class="card" style="width: 18rem;">
<div class="card-body">
<h5 class="card-title">Card Title</h5>
<p class="card-text">Some description text goes here.</p>
<a href="#" class="btn btn-primary">Learn More</a>
</div>
</div>Example — Responsive Grid:
<div class="container">
<div class="row">
<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>When to Use Bootstrap
| Use Case | Why Bootstrap Fits |
|---|---|
| Fast MVP / admin dashboard | Pre-built components mean less design work upfront |
| Team without dedicated designer | Sensible defaults look decent out of the box |
| Standard UI patterns (navbars, modals, forms) | Components like modal, dropdown, carousel come with JS behavior included |
| Consistent look across many pages quickly | Whole design system is baked in |
| Less control over unique branding | Trade-off: sites can look “Bootstrap-y” unless heavily customized |
3. Tailwind vs. Bootstrap — Quick Decision Guide
| Question | Answer |
|---|---|
| Need a highly custom, unique visual design? | Tailwind |
| Need to ship a standard UI fast with minimal styling effort? | Bootstrap |
| Want small production CSS bundle? | Tailwind (purges unused styles) |
| Want built-in JS components (modals, dropdowns, carousels)? | Bootstrap |
| Prefer styling in HTML/JSX directly? | Tailwind |
| Prefer semantic class names and separate stylesheets? | Bootstrap |
| Building a design system from scratch? | Tailwind |
| Prototyping internal tools/admin panels? | Bootstrap |
4. Other CSS Spin-Off Tools
| Tool | Type | What It’s For |
|---|---|---|
| Sass/SCSS | Preprocessor | Adds variables, nesting, mixins, functions to CSS (compiles to plain CSS) |
| PostCSS | Post-processor | Transforms CSS with plugins (e.g., autoprefixer for vendor prefixes) |
| CSS Modules | Scoping method | Locally scopes class names to avoid collisions in component-based apps |
| styled-components | CSS-in-JS | Write actual CSS inside JavaScript, scoped to React components |
| Bulma | Framework | Similar to Bootstrap but no built-in JS, purely CSS-based |
| Materialize / MUI | Framework | Implements Google’s Material Design system |
When to Use Each
| Use Case | Best Fit |
|---|---|
| Want CSS superpowers (variables, nesting) without leaving CSS syntax | Sass/SCSS |
| Need automatic vendor prefixing or modern CSS transforms | PostCSS |
| Building components and want zero class-name collisions | CSS Modules |
| Building in React and want styles colocated with components | styled-components |
| Want a lightweight Bootstrap alternative with no jQuery/JS baggage | Bulma |
| Building an app that should look/feel like Google products | Materialize / MUI |
5. Example — Same Component, Three Ways
Vanilla CSS:
.btn {
padding: 0.5rem 1rem;
background-color: #3b82f6;
color: white;
border-radius: 0.375rem;
}
.btn:hover {
background-color: #2563eb;
}Tailwind:
<button class="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600">
Click Me
</button>Bootstrap:
<button class="btn btn-primary">Click Me</button>