Sass list.slash()

Beginner
10 min read
Updated: Nov 2026
5 examples
Dart Sass 1.23+

Definition and Usage

list.slash($elements...) returns a slash-separated list that contains $elements. Load it with @use "sass:list" on Dart Sass 1.23+. There is no separate global slash().

Temporary helper.

Official docs: this exists while Sass finishes moving / away from division. Eventually slash lists may be written literally (for example 1px / 2px / solid). For real math, use math.div().

Official sample.

list.slash(1px, 50px, 100px) → 1px / 50px / 100px.

Common CSS uses.

font-size / line-height, aspect-ratio, elliptical border-radius, and other CSS values that use a slash separator.

Syntax

SCSS
@use "sass:list";
@use "sass:math";

list.slash(1px, 50px, 100px); // 1px / 50px / 100px
list.slash(16px, 1.5);        // 16px / 1.5
list.slash(16, 9);            // 16 / 9

// Real division (not a slash list)
math.div(16, 9);              // 1.777…

Pattern: build with list.slash → confirm with list.separator (slash) → emit into CSS.

Slash vs Division

Do not mix the two jobs of /:

GoalUse
CSS slash-separated valuelist.slash($a, $b, …)
Numeric divisionmath.div($a, $b)
Check separatorlist.separator($list) == slash
Force slash via join/append$separator: slash on those helpers
Global slash()Not provided — module only
Variadic arguments.

Pass as many elements as you need: list.slash($a, $b) or list.slash($a, $b, $c).

SCSS Examples

Examples target Dart Sass 1.23+ with @use "sass:list". Open View Compiled CSS for verified output (matches official Sass docs samples).

Example 1 — Build a Slash List (Official Docs)

Three lengths become one slash-separated value.

SCSS
@use "sass:list";

@debug list.slash(1px, 50px, 100px); // 1px / 50px / 100px

.sizes {
  --stack: #{list.slash(1px, 50px, 100px)};
  --sep: #{list.separator(list.slash(1px, 50px, 100px))};
  --len: #{list.length(list.slash(1px, 50px, 100px))};
}

How It Works

  1. Three arguments become three list items.
  2. Separator is slash — confirmed by list.separator.
  3. Length is 3, not a single divided number.
  4. Matches the official Sass docs sample.

Example 2 — font-size / line-height

Classic CSS font shorthand uses a slash between size and line-height.

SCSS
@use "sass:list";

$pair: list.slash(1.2rem, 1.6);

.font {
  font: list.slash(16px, 1.5) sans-serif;
}

.type {
  font: $pair Helvetica, sans-serif;
}

How It Works

  1. Slash list supplies size and line-height.
  2. Family names follow as a normal space/comma list.
  3. Store the pair in a variable when reusing tokens.
  4. Avoid join with space if you need to keep the slash intact as a nested pair.

Example 3 — aspect-ratio

Emit a CSS ratio without dividing the numbers.

SCSS
@use "sass:list";

.ratio {
  aspect-ratio: list.slash(16, 9);
}

How It Works

  1. 16 and 9 stay separate list items.
  2. CSS receives 16 / 9, not 1.777….
  3. That is the point of a slash list vs division.
  4. Useful for responsive media frames and cards.

Example 4 — Elliptical border-radius

Horizontal / vertical radii use a slash in CSS.

SCSS
@use "sass:list";

.radius {
  border-radius: list.slash(10px, 20px);
}

How It Works

  1. Two lengths become a slash pair.
  2. Compiled CSS keeps the slash separator.
  3. Same helper works for longer slash stacks too.
  4. Prefer tokens in variables when radii are shared.

Example 5 — list.slash vs math.div

Slash lists keep structure; division computes a number.

SCSS
@use "sass:list";
@use "sass:math";

.div-vs-slash {
  --slash: #{list.slash(16, 9)};
  --div: #{math.div(16, 9)};
}

How It Works

  1. list.slash emits a CSS slash value.
  2. math.div emits a computed number.
  3. Pick based on intent — ratio syntax vs arithmetic.
  4. Do not use / for division in modern Sass.

Edge Cases & Pitfalls

Most slash bugs are treating it like division, or flattening the pair with a space join.

math

Slash list ≠ division

Use math.div when you need a number. Use list.slash when CSS needs /.

module

No global slash()

Always load sass:list and call list.slash.

join

Careful when joining onto fonts

Prefer font: $pair Helvetica, sans-serif; so the slash pair stays intact.

temp

Temporary by design

Expect slash list literals later; keep call sites easy to migrate.

Sass Support

Prefer the module form with a current Dart Sass release. There is no global slash().

APIStatus
list.slash()Dart Sass via @use "sass:list" (slash-migration era)
Global slash()Not provided
Return typeSlash-separated list
LibSass / Ruby SassNo modern sass:list slash helper

Compile with the Dart Sass CLI.

Key Takeaways

  • Builds slash-separated lists for CSS syntax.
  • Use math.div for arithmetic — not slash lists.
  • Temporary API until slash literals are fully available.
  • Module only — no global slash().

One line: when CSS needs a slash-separated value, call list.slash($a, $b, …).

Compile Notes

Practical checklist:

checklist.txt
1. @use "sass:list"
2. Use list.slash for CSS slash values
3. Use math.div for real division
4. Confirm with list.separator(...) == slash
5. Keep call sites easy to migrate when slash literals arrive

Frequently Asked Questions

list.slash($elements...) returns a slash-separated list containing those elements. Example: list.slash(1px, 50px, 100px) is 1px / 50px / 100px.
Not currently. Official docs describe it as a temporary solution while Sass finishes moving / away from division. It is the supported way to create slash lists today. Later it may become redundant when slash list literals work everywhere.
Use math.div($a, $b) from sass:math. Do not rely on / for division—that path is being phased out in favor of slash as a list separator.
list.separator(list.slash(16, 9)) returns slash.
No. Unlike many other list helpers, slash is provided as list.slash() through the sass:list module (or via @use "sass:list" as *).
Built-in modules with @use need Dart Sass 1.23+. Slash-separated lists and list.slash() arrived as part of the slash-as-division migration—prefer a current Dart Sass release.

Next: Sass list.zip()

Combine multiple lists into a list of paired sub-lists.

list.zip() →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

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