Lists hold a sequence of values. Separators can be spaces (10px 15px 0 0), commas (Helvetica, Arial, sans-serif), or slashes (via list.slash()). Brackets are optional.
Indexes start at 1.
1 is the first item; -1 is the last. That differs from many languages that start at 0.
Immutable.
list.append() returns a new list. Reassign the variable if you need to accumulate values.
Empty () is not valid CSS.
Sass will not let you put an empty unbracketed list in a property value. Use [] when you need an empty bracketed list for CSS.
Lists are space- or comma-separated sequences (brackets optional).
Indexes start at 1; -1 is the last item.
@each is the usual way to generate CSS from a list.
Immutable—reassign after append.
One line: store related values in a list, then loop or look them up with sass:list helpers.
Practice
Compile Notes
Practical checklist:
checklist.txt
1. Pick space or comma separators (keep them consistent)
2. Remember indexes start at 1 (-1 = last)
3. Use @each to generate repeated CSS
4. Use list.nth / list.index / list.append from sass:list
5. Reassign after append—lists are immutable
Frequently Asked Questions
A list is a sequence of values. Elements can be separated by spaces, commas, or slashes (slash lists are created with list.slash()). Brackets like [a b] are optional but useful for CSS Grid.
No. Index 1 is the first element. Negative indexes count from the end: -1 is the last element.
No. Lists are immutable. Functions like list.append() return a new list; they do not change the original. Reassign the variable if you need to update state.
Use @each $item in $list { … }. Each element is assigned to $item once per iteration.
It returns null, which is falsey—so you can use it with @if to validate allowed values.
When a mixin or function uses $args..., the collected arguments form a special list. Keyword arguments are available via meta.keywords($args).