我有这个变量:
$gutter: 10;
我想在 SCSS 这样的选择器中使用它:
.grid+$gutter {
background: red;
}
所以输出变成了 CSS:
.grid10 {
background: red;
}
但这行不通。可能吗?
最佳答案
$gutter: 10;
.grid#{$gutter} {
background: red;
}
如果在字符串中使用,例如在 url 中:
background: url('/ui/all/fonts/#{$filename}.woff')
关于css - 我可以为选择器使用变量吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12743837/