我有一个css
文件,我想用sass
简化它,有些代码如下:
.slick-prev, .slick-next {
height: 30px !important;
}
.slick-prev:before, .slick-next:before {
color: #fff !important;
font-size: 30px !important;
}
.slick-prev:before {
content: "\f104" !important;
font-family: "FontAwesome" !important;
}
.slick-next:before {
content: "\f105" !important;
font-family: "FontAwesome" !important;
}
所以,差异仅在content: "\f104"
中有所不同,所以我试图简化它:
.slick-prev, .slick-next {
height: 30px !important;
&:before {
color: #fff important;
font-size: 30px !important;
// how can I write here?
}
}
如何判断父级是.slick-next:before
还是.slick-prev:before
?
答案 0 :(得分:1)
如何判断父级是
.slick-next:before
还是.slick-prev:before
?
你不能。
这是你可以简化它:
.slick-prev, .slick-next {
height: 30px !important;
&:before {
color: #fff !important;
font-size: 30px !important;
font-family: "FontAwesome" !important;
}
}
.slick-prev:before {
content: "\f104" !important;
}
.slick-next:before {
content: "\f105" !important;
}