纯CSS写法:
.border-1px{
position: relative
}
.border-1px: after{
display: block;
position: absolute;
left: 0;
bottom: 0;
width: 100%
boder-top: 1px solid #000;
conrent: ' ';
}
使用stylus预编译写法(强烈推荐)
border-1px($color) 定义一个css函数,$color为参数. &符号相当于js里的this,指选择器本身
position: relative
&:after
display: block
position: absolute
left: 0
bottom: 0
width: 100%
border-top: 1px solid $color
content: ' '
border-none()
&:after
display: none