題目:如何利用css實(shí)現(xiàn)一個(gè)0.5px的線
答:利用transform的scale(scaleY)屬性
實(shí)踐:
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>