2017-07-18 3 views
0

SASSの@forループの助けを借りて、すべてのレベルを乗算してパディング(ピクセル単位)を適用したいのですが、 。マイSASSのコードは次のとおりです。私はパッセージをSassのforループで乗算しようとしていますが、それは起こっていません。

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

}

し、その出力以下の私を与える:

.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; 
} 

答えて

1

[OK]をまいらソリューションを必要と私は解決策を持って、次のようにそれは次のとおりです。

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