纯css实现顶部进度条随滚动条滚动
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
body{
overflow-y: scroll;
overflow-x: hidden;
background: linear-gradient(to right top, deepskyblue 50%, #eee 50%) no-repeat;
background-size: 100% calc(100% - 100vh + 3px);
white-space:normal;
word-break:break-all;
word-wrap:break-word;
}
body::after{
content: '';
position: fixed;
top: 3px;
left: 0; right: 0; bottom: 0;
background: #fff;
z-index: -1;
}
</style>
</head>
<body>
sdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfassdfsdklfjsdlfas
</body>
</html>
摘自掘金:https://juejin.im/post/5c35953ce51d45523f04b6d2