On this page9 sections
  1. Learning Objectives
  2. 1. Sass
  3. 2. Bootstrap
  4. 3. Tailwind CSS
  5. 4. Which Should You Use?
  6. Common Beginner Mistakes
  7. Practice Questions
  8. Practice Answers
  9. Key Takeaways

Lecture 057: Preprocessors & Frameworks: Sass, Bootstrap & Tailwind

Category10: Tools & Workflow
Lecture057 of 057
Estimated video length12 min
TargetCSS3 · any modern browser
LevelIntermediate

You now know CSS itself. Many teams also use tools built on top of it. A preprocessor (Sass, Less) adds extra features and compiles to normal CSS; a framework (Bootstrap, Tailwind) gives you ready-made styles. This lecture shows what each offers, so you can choose, and read projects that use them.


Learning Objectives

  • Explain what a preprocessor does and recognise Sass syntax
  • Use Bootstrap's grid and components
  • Read Tailwind's utility classes
  • Decide when plain CSS, a preprocessor or a framework fits best

1. Sass

Sass files (.scss) are compiled into a normal .css file that the browser loads.

scss
// variables
$brand: #1971c2;
$radius: 8px;

// mixins: reusable groups of declarations
@mixin card { padding: 16px; border-radius: $radius; box-shadow: 0 2px 8px rgba(0,0,0,.1); }

// nesting, mixins and functions
.button {
  background: $brand;
  border-radius: $radius;
  &:hover { background: darken($brand, 10%); }
}
.product { @include card; }

// partials: split into files and combine
@use 'base';

Many of Sass's best features now exist in plain CSS: variables (Lecture 046), nesting (Lecture 028) and color-mix() (Lecture 034). Sass is still popular for mixins, loops and organising big projects. Less is a similar, older preprocessor.


2. Bootstrap

Add Bootstrap's stylesheet and use its classes:

Example

html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">

<div class="container py-3">
  <div class="row g-3">
    <div class="col-12 col-md-6"><div class="p-3 bg-primary text-white rounded">col-md-6</div></div>
    <div class="col-12 col-md-6"><div class="p-3 bg-success text-white rounded">col-md-6</div></div>
  </div>
  <button class="btn btn-primary mt-3">Primary</button>
  <button class="btn btn-outline-secondary mt-3">Secondary</button>
  <div class="alert alert-warning mt-3">A ready-made alert box.</div>
</div>
  • A 12-column grid: col-md-6 means "half width from medium screens up".
  • Components: buttons, cards, navbars, modals and forms, all with consistent styles.
  • Utilities: p-3 (padding), mt-3 (margin-top), text-white, rounded.

3. Tailwind CSS

Tailwind is utility-first: instead of writing .card { … }, you combine small classes in the HTML.

Example

html
<script src="https://cdn.tailwindcss.com"></script>

<div class="max-w-sm mx-auto p-6 bg-white rounded-2xl shadow-lg flex items-center gap-4">
  <div class="w-12 h-12 rounded-full bg-indigo-500"></div>
  <div>
    <p class="text-lg font-semibold text-gray-900">Tailwind card</p>
    <p class="text-sm text-gray-500">Styled only with utility classes</p>
  </div>
</div>
<button class="mt-4 px-4 py-2 rounded-lg bg-emerald-600 hover:bg-emerald-700 text-white">Hover me</button>
ClassMeans
p-6padding: 1.5rem
mx-automargin-inline: auto
flex items-center gap-4Flexbox, centred, 1rem gap
md:grid-cols-3Three columns from medium screens up
hover:bg-emerald-700Background colour on hover

The CDN script is for trying Tailwind out; real projects install it with a build tool, which keeps only the classes you use.


4. Which Should You Use?

ChoiceGood forWatch out for
Plain CSSLearning, small sites, full controlYou build every component yourself
SassLarge stylesheets, design systemsA build step to compile it
BootstrapQuick, consistent sites and admin panelsSites that all look alike unless customised
TailwindCustom designs built fast, component-based appsLong class lists in the HTML

Whatever you choose, it all becomes CSS in the end. Everything you've learned in this course is what makes these tools understandable.


Common Beginner Mistakes

1. Learning a framework before CSS. When something breaks, you won't know why.

2. Loading a whole framework for one button. It's a big download.

3. Fighting the framework. If you override most of Bootstrap, plain CSS (or Tailwind) may suit you better.


Practice Questions

  1. What does a CSS preprocessor do?
  2. Which Sass features now exist in plain CSS?
  3. In Bootstrap, what does col-md-4 mean?
  4. What does "utility-first" mean in Tailwind?
  5. What does Tailwind's md: prefix do?
  6. Why is it worth learning plain CSS first?

Practice Answers

  1. It adds features such as variables, nesting and mixins, then compiles to normal CSS.
  2. Variables (custom properties), nesting and colour functions such as color-mix().
  3. A third of the row (4 of 12 columns) on medium screens and up.
  4. You style elements by combining many small single-purpose classes in the HTML.
  5. It applies the class only from the medium breakpoint upwards.
  6. Every tool produces CSS, so understanding CSS lets you use, customise and debug any of them.

Key Takeaways

  • Preprocessors (Sass, Less) add features and compile to CSS.
  • Bootstrap gives a 12-column grid and ready components; Tailwind gives utility classes.
  • Choose by project size and design needs, and remember it's all CSS underneath.
  • You've finished the CSS course. Combine it with the HTML course, and you can build and style any page.