2
.myclass {

    position: absolute; 

    $positions: 0 1 2 3 4 5 6 7;
    @each $position in $positions {
        &.x#{$position} {
            top: #{$position}%; 
        }    
        &.y#{$position} {
            left: #{$position}%; 
        }   
    }

}

Did i make something wrong? VsCode tells me [scss] term expected aftr the % signs, can you tell me is it a bug or did i make a mistake?

1 Answer 1

3

That should work just fine:

#{$position}#{"%"}

UPDATE:

I think compiler recognizes % as start of placeholder selector (so it expects placeholder name after percent sign), it's required in this case that you declare "%" as string.

"Placeholder selectors" @ sass-lang.com/documentation/file.SASS_REFERENCE.html

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.