scss dynamic variable

Solutions on MaxInterview for scss dynamic variable by the best coders in the world

showing results for - "scss dynamic variable"
Lilli
03 Sep 2019
1/*Sass ( Scss ) does not allow variables to be created or accessed dynamically. 
2However, you can use lists for similar behavior.*/
3$list: 20px 30px 40px;    
4@mixin get-from-list($index) {
5  width: nth($list, $index);
6}
7
8$item-number: 2;
9#smth {
10  @include get-from-list($item-number);
11}
12/*OutPut*/
13#smth {
14  width: 30px; 
15}