2017-07-18 1 views
0

Mit Hilfe von @for-Schleife in SASS möchte ich Padding (Pixel-Einheit) auf meiner Liste durch Multiplikation für jede Ebene anwenden, aber es gibt mir Rohausgabe . Mein SASS-Code ist:Ich versuche Padding mit For-Schleife in Sass zu multiplizieren, aber es passiert nicht

@for $i from 1 through 5 { 
.chapter-summary { 
    &:nth-child(#{$i}) { 
     padding-bottom: (10px) * #{$i}; 
    } 
} 

}

und sein gibt mir folgende Ausgabe:

.chapter-summary:nth-child(1) { 
    padding-bottom: 10px * 1; 
} 

.chapter-summary:nth-child(2) { 
    padding-bottom: 10px * 2; 
} 

.chapter-summary:nth-child(3) { 
    padding-bottom: 10px * 3; 
} 

.chapter-summary:nth-child(4) { 
    padding-bottom: 10px * 4; 
} 

.chapter-summary:nth-child(5) { 
    padding-bottom: 10px * 5; 
} 

Benötigen Sie eine Lösung

Antwort

1

Ok guyz ich die Lösung habe, und das ist, wie folgend:

@for $i from 1 through 5 { 
    .chapter-summary { 
     &:nth-child(#{$i}) { 
      padding-bottom: #{$i * 10px}; 
     } 
    } 
} 
Verwandte Themen