list.slash() belongs to the built-in sass:list module. It builds a slash-separated list when you cannot type / as a list separator yet. This page covers why it exists, how it differs from math.div(), pairing with list.separator, Dart Sass support, and five compiled examples.
01
Concept
Build a / b lists
02
Module
@use "sass:list"
03
Status
Temporary helper
04
Not division
Use math.div
05
Pair with
list.separator
06
Practice
5 examples
Concept
What Is list.slash()?
CSS uses slash separators in places like aspect-ratio: 16 / 9, font: 1.2em / 1.5, and some grid / color syntax. Sass historically treated / as division, so you cannot always write slash lists literally yet. list.slash creates that list structure for you.
list.slash(1px, 50px, 100px) → 1px / 50px / 100px
list.slash(16, 9) → 16 / 9
list.separator(list.slash(16, 9)) → slash
⚠️
Heads up from the docs
Official Sass docs: list.slash() is a temporary solution for creating slash-separated lists. Eventually you will write them literally (for example 1px / 2px / solid). Until slash-as-division is fully retired, use this helper—and use math.div() when you mean real math.
Foundation
📝 Syntax
Load the list module, then pass one or more values:
styles.scss
@use "sass:list";
list.slash($elements...)
Parameters
Parameter
Type
Required
Description
$elements...
Any (variadic)
Yes (one or more)
The values to place in the slash-separated list, in order.
Return value
Type
Result
List
A slash-separated list containing $elements
Modules
📦 Loading sass:list
styles.scss
// Recommended — namespaced
@use "sass:list";
$ratio: list.slash(16, 9);
// Optional — bring members into scope
@use "sass:list" as *;
$ratio: slash(16, 9);
// Optional — custom namespace
@use "sass:list" as l;
$ratio: l.slash(16, 9);
⚠️
No legacy global slash()
Unlike nth or length, there is no separate global slash() outside the module system. Use list.slash (or @use "sass:list" as *).
Details
🔍 list.slash vs math.div
Both involve the / character in Sass history, but they answer different questions.
list.slash
math.div
Purpose
Build a slash-separated list
Perform numeric division
Example
list.slash(16, 9) → 16 / 9
math.div(16, 9) → 1.777…
CSS use
aspect-ratio, font size/line-height
Computed numbers and units
Module
sass:list
sass:math
Compare
📋 Creating Slash Lists Other Ways
You can also force a slash separator with list.join() or list.append via $separator: slash.
styles.scss
@use "sass:list";
// Dedicated helper
$list: list.slash(10px, 20px);
// Same separator idea via join
$more: list.join($list, list.slash(30px, 40px), $separator: slash);
// → 10px / 20px / 30px / 40px
Support
🛠 Compatibility
This is about Sass compilers, not browsers. Compiled CSS only contains the finished slash-separated values (for example in aspect-ratio).
Implementation
list.slash()
Notes
Dart Sass
Yes — preferred
Part of the slash-as-division migration; keep Dart Sass current
LibSass
No modern module API
Does not load sass:list with @use
Ruby Sass
No modern module API
Legacy—prefer Dart Sass
Cheat Sheet
⚡ Quick Reference
Goal
Code
Import list
@use "sass:list";
Slash list
list.slash(1px, 50px, 100px)
Aspect ratio
aspect-ratio: list.slash(16, 9);
Check separator
list.separator($list) → slash
Real division
math.div($a, $b)
Join as slash
list.join($a, $b, $separator: slash)
Hands-On
Examples Gallery
Each example uses @use "sass:list". Open View Compiled CSS for verified Dart Sass output (official samples where noted).
📚 Getting Started
Official docs sample and separator checks.
Example 1 — Create a Slash List (Official Docs)
Build a three-item slash list and confirm the separator name.
Migration tooling — keep slash lists while moving division to math.div.
Design systems — store slash tokens and inspect them with list.separator.
🧠 How Compilation Works
1
Write SCSS
Call list.slash($a, $b, …) after @use "sass:list".
Source
2
Build a slash list
Dart Sass stores the values with a slash separator (not as division).
Compile
3
Emit CSS
Properties receive values like 16 / 9 or span 3 / 7.
Result
4
✓
Browser sees CSS slashes
No Sass function remains—only the finished slash-separated CSS.
Watch Out
⚠️ Common Pitfalls
Using slash for math — division belongs in math.div, not list.slash.
Expecting a number — list.slash(16, 9) is a list, not 1.777.
Assuming a global slash() — use the sass:list module API.
Forgetting it is temporary — plan for literal slash lists as Sass evolves.
Forgetting @use — list.slash needs sass:list.
Pro Tips
💡 Best Practices
✅ Do
Use list.slash() when CSS needs a slash-separated value
Use math.div() for numeric division
Verify with list.separator(...) → slash
Prefer current Dart Sass for the slash migration
Keep slash tokens in variables for reuse
❌ Don’t
Treat list.slash(16, 9) as division math
Expect the browser to call list.slash
Rely on LibSass for @use "sass:list"
Assume a long-term permanent API (docs mark it temporary)
Confuse space lists with slash lists when joining
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about list.slash()
Temporary slash-list builder—not division; pair with math.div for math.
5
Core concepts
📝01
Call
list.slash($elements...)
API
📦02
Module
sass:list
@use
🔢03
Returns
slash-separated list
Rule
❓04
Status
temporary helper
Docs
✓05
Division
use math.div()
Tooling
❓ 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.
Did you know?
The Sass migrator can help move stylesheets from slash-as-division to math.div() and list.slash(). See the official Breaking Change: Slash as Division guide for the full timeline.
list.slash() builds slash-separated Sass lists for CSS values like aspect ratios and font size/line-height pairs. It is a temporary helper during the slash-as-division migration—use math.div() for math, and list.separator to inspect the result.