Answers for "scss dynamic variable"

CSS
0

scss dynamic variable

/*Sass ( Scss ) does not allow variables to be created or accessed dynamically. 
However, you can use lists for similar behavior.*/
$list: 20px 30px 40px;    
@mixin get-from-list($index) {
  width: nth($list, $index);
}

$item-number: 2;
#smth {
  @include get-from-list($item-number);
}
/*OutPut*/
#smth {
  width: 30px; 
}
Posted by: Guest on June-07-2021

Code answers related to "scss dynamic variable"

Browse Popular Code Answers by Language