题目:如何利用css实现一个0.5px的线
答:利用transform的scale(scaleY)属性
实践:
code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.pxhalf {
background: black;
height: 1px;
width: 100%;
transform: scaleY(0.5);
}
</style>
</head>
<body>
<h1>0.5 px的线</h1>
<div class="pxhalf"> </div>
<br>
<h1>1 px的线</h1>
<hr style=" border: none; color: blue; background-color: black; height: 1px; width: 100%;" />
</body>
</html>