<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
.loading-box{
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
.loading .circular {
animation: loading-rotate 2s linear infinite;
height: 42px;
width: 42px;
}
.loading .path {
stroke-dasharray: 90, 150;
stroke-dashoffset: 0;
stroke-width: 2;
stroke: #099dfd;
stroke-linecap: round;
animation: loading-dash 1.5s ease-in-out infinite;
}
@keyframes loading-dash {
0% {
stroke-dasharray: 1, 200;
stroke-dashoffset: 0;
}
50% {
stroke-dasharray: 90, 150;
stroke-dashoffset: -40px;
}
100% {
stroke-dasharray: 90, 150;
stroke-dashoffset: -120px;
}
}
@keyframes loading-rotate {
100% {
transform: rotate(1turn);
}
}
</style>
</head>
<body>
<div class="loading-box">
<div class="loading">
<svg viewBox="25 25 50 50" class="circular">
<circle cx="50" cy="50" r="20" fill="none" class="path"></circle>
</svg>
</div>
</div>
</body>
</html>
css编写一个loading框(亲测可用)
于 2023-12-07 16:21:07 首次发布