Sass is a stylesheet language that compiles to plain CSS. Most people write its SCSS syntax, which looks like CSS with extras: variables, nesting, partial files, mixins, functions, maps and loops. Those features let you build a small design system, such as a spacing scale or a set of theme colors, and generate consistent CSS from it. The current official implementation is Dart Sass, and its module system with @use and @forward has replaced the older @import. Learnr teaches Sass through short lessons and refactoring exercises on real-looking stylesheets.
How to learn Sass, step by step
- Know CSS well before adding Sass. Sass only generates CSS, so the cascade, specificity, flexbox and grid still decide how things look. If a layout is broken in plain CSS, Sass will not fix it.
- Compile a first file and read the output. Install Dart Sass through npm or your bundler and compile a file with variables and nesting. Always look at the generated CSS, because that is how you learn what each feature costs.
- Split styles into partials with @use. Create partials such as _tokens.scss, _buttons.scss and _layout.scss and load them with @use, which namespaces members. Avoid the deprecated @import, which leaks every variable globally.
- Write mixins for repeated patterns. Build a breakpoint mixin that takes a size name from a map, and a focus-ring mixin for accessible states. Prefer mixins or placeholders over @extend across files, which can produce surprising selectors.
- Generate utilities from maps. Store a spacing scale in a map and use @each to output margin and padding classes. Then try the sass:math and sass:color modules for calculations that stay readable.
- Refactor a real stylesheet. Take an existing CSS file of a few hundred lines and convert it, extracting tokens and mixins. Quick Learnr lessons between sessions help module rules and syntax stick.
What you'll learn
- Compile SCSS to CSS with Dart Sass from the command line or a build tool
- Organize styles into partials loaded with @use and @forward
- Write mixins and functions for breakpoints, spacing and color
- Generate utility classes from maps with @each loops
- Decide when to use Sass variables versus CSS custom properties
How long does it take to learn Sass?
If you already write CSS confidently, the core of Sass takes about 1 to 2 weeks at a few hours a week. Designing a clean architecture for a large project takes longer and grows with experience on real codebases.
What you need before you start
Solid HTML and CSS, including selectors, specificity and responsive layout. Basic command line and npm use helps with installation and build tools.
Common mistakes to avoid
- Nesting selectors many levels deep to mirror the HTML, which produces long, highly specific selectors that are hard to override. Keep nesting to two or three levels.
- Still using @import out of old tutorials. Move to @use and @forward, since @import is deprecated in Dart Sass.
- Using Sass variables for values that must change at runtime, like a dark theme. Output CSS custom properties for those instead.
How Learnr builds your course
Type your topic
Tell Learnr you want to learn Sass, or get as specific as you like.
Get a personalized course
Learnr instantly builds a full Sass course tailored to your goal and skill level.
Learn and level up
Move through bite-sized lessons and interactive practice, earning XP and keeping your streak.
Sass questions, answered
Is Sass still needed now that CSS has variables and nesting?
Less than before. Native CSS now has custom properties and nesting, which covers many simple cases. Sass still adds mixins, functions, loops, maps and modules, which are useful for design systems and large codebases.
What is the difference between Sass and SCSS?
They are two syntaxes of the same language. SCSS uses braces and semicolons like CSS, so any valid CSS file is valid SCSS. The older indented syntax uses whitespace instead. Most projects use SCSS.
Explore more courses
More programming and tech courses
- Learn Electron.js
- Learn Firebase
- Learn Operating Systems
- Learn Compiler Design
- Learn Distributed Systems
- Learn Reverse Engineering
- Learn Digital Forensics
- Learn Selenium
See all programming and tech courses
Ready to learn Sass?
Start your free, personalized Sass course in seconds. It will be typed in and ready when you get there.
Start learning SassFree to start. No credit card.