less
@col : #26a2ff; //设置默认颜色
.border-1px(@color: @col, @w: 1px) {
//scss中设置默认值
position: relative;
&:after {
display: block;
position: absolute;
left: 0;
bottom: 0;
width: 100%;
border-top: @w solid @color;
content: ' ';
}
} // 这样也可以结局1px变粗的问题;
.border-none() {
&:after {
display: none;
}
}
.bg-image(@url) {
background-image: url("@{url} + @2x.png");
@media (-webkit-min-device-pixel-ratio: 3), (min-device-pixel-ratio: 3) {
background-image: url("@{url} + @3x.png");
}
}
sass
$col : #26a2ff; //设置默认颜色
@mixin border-1px($color:$col,$w:1px){ //scss中设置默认值
position: relative;
&:after{
display: block;
position: absolute;
left: 0;
bottom: 0;
width: 100%;
border-top: $w solid $color;
content: ' ';
}
} // 这样也可以结局1px变粗的问题;
@mixin border-none(){
&:after{
display: none;
}
}
@mixin bg-image($url){
background-image: url( $url + "@2x.png");
@media (-webkit-min-device-pixel-ratio: 3),(min-device-pixel-ratio: 3){
background-image: url( $url + "@3x.png");
}
}