Sass Syntax

Beginner
8 min read
Updated: Nov 2026
5 examples
Dart Sass

Definition and Usage

Sass has two syntaxes: SCSS (.scss) and the indented syntax (.sass). Both support the same features, and each can load the other.

Start with SCSS.

SCSS is a CSS-like superset (with a few small exceptions). Almost all valid CSS is valid SCSS—easiest for beginners and the most popular.

Indented = original Sass.

Use indentation instead of { } and semicolons. People often call this “Sass” because of the .sass extension—SCSS is still Sass.

Same language, different writing style.

Pick one for your team. Mixing files is fine because either syntax can @use the other.

The Two Syntaxes

SCSS
.btn {
  display: inline-flex;
  &:hover { cursor: pointer; }
}
Sass
.btn
  display: inline-flex
  &:hover
    cursor: pointer

Rule of thumb: wherever SCSS uses braces, indent one level in .sass. Wherever a statement can end, a newline acts like a semicolon.

Quick Comparison

Side-by-side differences:

TopicSCSS (.scss)Indented (.sass)
Looks likeCSS with braces / semicolonsIndentation instead of braces
CSS familiarityNear-superset of CSSDifferent punctuation rules
FeaturesFull SassFull Sass (same)
Load the otherYes (@use, etc.)Yes
Best forBeginners & most teamsFans of terse indented style

SCSS & Sass Examples

Open View Compiled CSS for verified Dart Sass output. SCSS and indented samples that do the same thing compile to the same CSS.

Example 1 — SCSS (Official Style)

Braces, semicolons, and nested & states—CSS-familiar.

SCSS
@mixin button-base() {
  display: inline-flex;
  position: relative;
  height: 40px;
  border: none;
  vertical-align: middle;

  &:hover {
    cursor: pointer;
  }

  &:disabled {
    cursor: default;
    pointer-events: none;
  }
}

.btn {
  @include button-base;
  color: #111;
}

How It Works

  1. .scss uses CSS-like punctuation.
  2. @mixin holds shared declarations.
  3. &:hover nests states on the parent.
  4. Matches the official SCSS sample idea.

Example 2 — Indented Syntax (Same Features)

Same mixin and button—indentation replaces braces and semicolons.

Sass
@mixin button-base()
  display: inline-flex
  position: relative
  height: 40px
  border: none
  vertical-align: middle

  &:hover
    cursor: pointer

  &:disabled
    cursor: default
    pointer-events: none

.btn
  @include button-base
  color: #111

How It Works

  1. .sass uses indentation for structure.
  2. Newlines end statements (like semicolons).
  3. Features match Example 1 exactly.
  4. CSS output is the same as the SCSS version.

Example 3 — Nested Rules in SCSS

Nested selectors with braces—common SCSS style.

SCSS
.card {
  padding: 1rem;

  .title {
    font-weight: bold;
  }
}

How It Works

  1. Inner .title nests under .card.
  2. Compiler flattens to .card .title.
  3. More on nesting.
  4. Compare with Example 4.

Example 4 — Nested Rules in Indented Sass

Same nesting without braces—indent one level deeper.

Sass
.card
  padding: 1rem
  .title
    font-weight: bold

How It Works

  1. Indent replaces the SCSS braces.
  2. No semicolons on declarations.
  3. Same CSS as Example 3.
  4. Whitespace must stay consistent (spaces or tabs, not mixed).

Example 5 — SCSS Loads an Indented Partial

Each syntax can load the other—here SCSS @uses a .sass file.

Sass
$accent: #c6538c
SCSS
@use "theme" as *;

.button {
  color: $accent;
}

How It Works

  1. _theme.sass defines a variable in indented syntax.
  2. load.scss loads it with @use.
  3. as * brings members into the local namespace.
  4. Teams can mix file styles without rewriting everything.

Edge Cases & Pitfalls

Most syntax bugs are the wrong extension or mixed indentation in .sass.

.scss

Extension picks the parser

Indented code in a .scss file (or braces in .sass) will fail. Match the extension to the style.

indent

Keep indentation consistent

In .sass, spaces vs tabs matter. Pick one and stick to it.

multiline

Multiline indented statements need Dart Sass 1.84+

Line breaks only where a statement cannot end (inside brackets, or between keywords in Sass @-rules).

name

“Sass” vs SCSS naming

People say “Sass” for the indented syntax. SCSS is still Sass—just the CSS-compatible form.

Sass Support

Both syntaxes are first-class on Dart Sass.

FeatureStatus
SCSS (.scss)Supported
Indented syntax (.sass)Supported
Load SCSS from Sass / vice versaSupported
Multiline indented statementsDart Sass 1.84+

Compile with the Dart Sass CLI.

Key Takeaways

  • Two syntaxes: SCSS and indented .sass.
  • Same features—only the writing style changes.
  • Beginners: prefer SCSS (CSS-like).
  • Either can load the other with @use.

One line: choose SCSS unless you specifically want the indented .sass style—both are Sass.

Compile Notes

Practical checklist:

checklist.txt
1. Pick .scss (recommended) or .sass
2. Match braces/semicolons OR indentation to that choice
3. Keep indentation consistent in .sass files
4. Use @use to load the other syntax when needed
5. Compile with the Dart Sass CLI

Frequently Asked Questions

Two. SCSS uses the .scss extension and looks like CSS with braces and semicolons. The indented syntax uses .sass and uses indentation instead of braces and semicolons.
SCSS. It is the easiest to learn and the most popular because almost all valid CSS is valid SCSS.
No. Both support the same Sass features. Only the writing style differs (braces/semicolons vs indentation).
Yes. Each syntax can load the other (for example with @use), so teams can mix .scss and .sass files if needed.
Because it uses the .sass extension, people often just call it "Sass". SCSS is still Sass—it is the CSS-compatible syntax of the same language.
In Dart Sass 1.84+, yes—when line breaks occur where a statement cannot end (inside parentheses/brackets, or between keywords in Sass @-rules).

Next: Sass Parsing

See how Sass reads Unicode input and reports parse errors.

Parsing →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful