21 | Using Lists to Work with Multiple Properties |
Lists are used in many places in Sass. In fact, Sass treats most values and properties as lists by default. For example, in the declaration padding: 10px 20px 5px 5px;, Sass assumes that the pixel values are a list of four items. Lists are just a series of items that can be separated by a comma or a space. Lists can even consist of just one item. Some great use cases for lists are keeping multiple font selections together, or creating a collection of colors that you need for a style guide.
You can select items in a list by using the nth($list, $n) function. It takes two arguments: the list of items, followed by the index of the item in the list. In Sass, index counting starts at 1.
The example ...
Get Pragmatic Guide to Sass 3 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.