如何减少这个css代码
我正在为我的项目使用这个css代码,现在我计划将所有这些移到sass文件中。我不知道如何减少这个代码。我是sass新手:有没有办法减少下面的css代码如何减少这个css代码,css,sass,Css,Sass,我正在为我的项目使用这个css代码,现在我计划将所有这些移到sass文件中。我不知道如何减少这个代码。我是sass新手:有没有办法减少下面的css代码 .push-bottom-0 { padding-bottom: 0px; } .push-bottom-3 { padding-bottom: 3px; } .push-bottom-5 { padding-bottom: 5px; } .push-bottom-10 { padding-bottom: 10px; } .pus
.push-bottom-0 {
padding-bottom: 0px;
}
.push-bottom-3 {
padding-bottom: 3px;
}
.push-bottom-5 {
padding-bottom: 5px;
}
.push-bottom-10 {
padding-bottom: 10px;
}
.push-bottom-13 {
padding-bottom: 10px;
}
.push-bottom-20 {
padding-bottom: 20px;
}
.push-bottom-30 {
padding-bottom: 30px;
}
.push-bottom-40 {
padding-bottom: 40px;
}
.push-bottom-50 {
padding-bottom: 50px;
}
.push-bottom-60 {
padding-bottom: 60px;
}
.push-bottom-70 {
padding-bottom: 70px;
}
.push-bottom-80 {
padding-bottom: 80px;
}
.push-bottom-90 {
padding-bottom: 90px;
}
.push-bottom-100 {
padding-bottom: 100px;
}
你可以试试sass循环
@列表0351013203005060708090100
@$list中的每个$number
.push bottom-{$number}{
填充底部:$number;
}
您可以使用循环
:
@each $i in 0 3 5 10 13 20 30 40 50 60 70 80 90 100
.push-bottom-#{$i}
padding-bottom: #{$i}px
@each $i in 0, 3, 5, 10, 13, 20, 30, 40, 50, 60, 70, 80, 90, 100 {
.push-bottom-#{$i} {
padding-bottom: #{$i}px;
}
}