css给div添加0.5px的边框
具体代码实现如下:
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>border</title> 6 <style> 7 div{ 8 position: relative; 9 width: 100%; 10 background-color: #fff; 11 } 12 div:before{ 13 content: ""; 14 display: block; 15 position: absolute; 16 left: 0; 17 right: 0; 18 height: 1px; 19 color: #d9d9d9; 20 top: 0; 21 border-top: 1px solid #d9d9d9; 22 -webkit-transform-origin: 0 0; 23 transform-origin: 0 0; 24 -webkit-transform: scaleY(.5); 25 transform: scaleY(.5); 26 27 } 28 </style> 29 </head> 30 <body> 31 <div> 32 border 0.5px 33 </div> 34 </body> 35 </html>