首页
归档
笔记
树洞
搜索
友言

文章详情

Interesting People Record Interesting.

/ CSS / 文章详情

伪元素实现打点 loading 效果

Sonder
2020-12-17
692字
2分钟
浏览 (3.2k)

关键点

  • 非常有意思,借助动画操控伪元素的 content

一看就懂:

HTML:

复制代码
<p>加载中</p>

SCSS:

复制代码
p {
   position: absolute;
   top: 50%;
   left: 50%;
   transform: translate(-50%, -50%);
   font-size: 6vw;
   line-height: 8vw;
}

p::after {
   content: "";
   position: absolute;
   top: 0%;
   bottom: 0;
   animation: dot 3s infinite steps(3, start);
   line-height: 9vw;
}

@keyframes dot {
   33.33% {
       content: ".";
   }
   66.67% {
       content: "..";
   }
   100% {
       content: "...";
   }
}

下一篇 / Vue Uncaught SyntaxError: Unexpected token '*'

🎯 相关文章

💡 推荐文章

🕵️‍♂️ 评论 (0)