其他分享
首页 > 其他分享> > 通过伪类元素画0.5px细线

通过伪类元素画0.5px细线

作者:互联网

在H5开发中,经常会需要给div元素添加边框,我们往往会设置1pxborder,不过在真机显示上看,1px的边框看起来比较粗,影响美观,所以,可以用通过伪类元素设置1px宽度边框的同时配合transform来缩小一倍的宽度来实现即可。以下是代码:

.line_btm {
    position: relative
}

.line_btm:before {
    content: " ";
    position: absolute;
    z-index: 3;
    left: 0;
    bottom: -1px;
    width: 100%;
    height: 1px;
    border-bottom: 1px solid #D9D9D9;
    -webkit-transform-origin: 0 0;
    transform-origin: 0 0;
    -webkit-transform: scaleY(.5);
    transform: scaleY(.5)
}

标签:origin,伪类,px,0.5,transform,边框,1px,scaleY
来源: https://blog.csdn.net/weixin_39782183/article/details/104718255