css3写出0.5px的边框

一说到0.5px的边框,我们一般认为是不行的,因为在ps中0.5px的线也是做不出来的,这个计算机的像素有关系。

废话不多说了,0.5px 其实用的是css3新特性,box-shadow:阴影设置

代码

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
</head>
<body>
<div style="margin-top: 10px;border:1px solid #f00; 100px; height: 20px;">1px 红色的边框</div>
<div style="margin-top: 10px; 100px;height: 20px;box-shadow:0.5px 0.5px #f00 ,0.5px 0.5px #f00 inset">
0.5px 红色的边框
</div>
</body>
</html>
原文地址:https://www.cnblogs.com/tongchuanxing/p/5358237.html