css - Sass 3.3.7 - dynamically create list of icons -
i have list of icon class names like
auth-single-multi,auth-batch,auth-file,auth-imp-file,auth-man-fund-tran
i want loop through list (100 icons in total) , define class each each icon's background-position-y property 25px less previous icon value
.auth-single-multi { background-position:0 0;} .auth-batch { background-position:0 -25px;} .auth-file { background-position:0 -50px;} .auth-imp-file { background-position:0 -75px;} ... ... ...
i'm using latest version of sass keen use new features such maps.
any suggestions on best way approach welcome.
$list : single-multi batch file imp-file man-fund-tran; @mixin gen($selector, $postfix-list, $property-name, $delta) { $i : 0; @each $postfix in $postfix-list { #{$selector + $postfix}{ #{$property-name} : $i; } $i : $i - $delta; } } @include gen(".auth-px-", $list, 'background-position-left', 25px); @include gen(".auth-percentage-", $list, 'background-position-top', 50%);
Comments
Post a Comment