css实现物理像素1px

//利用背景图来画一个
//左竖线
.thin-line{
    background: -webkit-linear-gradient(left, transparent 50%, #e5e5e5 50%) no-repeat top left;
    background-size: 1px 100%;
}
//下横线
.thin-line{
    background: -webkit-linear-gradient(bottom, transparent 50%, #e5e5e5 50%) no-repeat bottom left;
    background-size: 100% 1px;
}
//利用::after伪类元素来给一个绝对定位
div::after{
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    background: -webkit-linear-gradient(top, transparent 50%, #f2f2f2 50%) no-repeat bottom left;
    background-size: 100% 1px;
    width: 100%;
    height: 1px;
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容