From the course: Sass Essential Training
Unlock the full course today
Join today to access over 24,100 courses taught by industry experts.
Each - Sass Tutorial
From the course: Sass Essential Training
Each
- [Instructor] Now that we understand lists and how to access them, let's talk about some of the ways that you can get to the element, starting with the @each rule. The each statement allows you to emit a number of styles based on a list or a map, which we'll get into a little bit later. Use an at rule with a variable to use for each statement as you navigate through an expression. Now, the expression is usually a list or something that computes to a list, like some of the methods that we saw in the previous video. You can also use destructuring, so that you can create a series of variables from a complex list. Here's a good example, based on some of the things that we've been doing with buttons. We're creating a mix in here to go through a button and create it based on a name, a background, and optionally, a color. And so what we're doing here is creating a list, and this list has two elements. Each element isâ¦
Contents
-
-
-
-
-
(Locked)
Interpolation2m 22s
-
(Locked)
Placeholder selectors1m 29s
-
(Locked)
Comments1m 52s
-
(Locked)
Using lists9m 21s
-
(Locked)
Each2m 47s
-
(Locked)
For2m 1s
-
(Locked)
Maps5m 1s
-
(Locked)
Operators and conditionals5m 57s
-
(Locked)
Color functions4m 27s
-
(Locked)
Challenge: Badges1m 36s
-
(Locked)
Solution: Badges8m 43s
-
(Locked)
-