如何使用css实现一个加载动画 有四个点 初始化为同一个颜色 每个阶段 不同的透明度 刷新也不会影响初始化
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title>
</head>
<body>
<div class="loading-container"><div class="loading-dot dot1"></div><div class="loading-dot dot2"></div><div class="loading-dot dot3"></div><div class="loading-dot dot4"></div>
</div>
</body>
<style>/*加载动画开始*/.loading-container {padding: 5px 0;position: relative;}.loading-dot {width: 7px;height: 7px;border-radius: 50%;margin: 0 3px;background: #327eff;animation: loading 3s infinite;float: left;}.dot1 {animation-delay: -1.5s;}.dot2 {animation-delay: -1s;}.dot3 {animation-delay: -0.5s;}.dot4 {animation-delay: 0s;}@keyframes loading {0% {opacity: 0.25;}50% {opacity:1;}100% {opacity: 0.25;}}/*加载动画结束*/
</style>
</html>