加载状态按钮 · 按钮
前端Wiki/CSS 特效合集/加载状态按钮

加载状态按钮

点击后左侧转圈、文字变「提交中」,禁用再次点击

← 返回 按钮 类特效列表

上方为纯 CSS 实时演示,直接将鼠标移上去 / 点击感受效果

CSS 代码

CSS
.fx .lbtn{position:relative;display:block;width:200px;margin:50px auto;padding:14px 0;border:none;border-radius:10px;background:#4a9eff;color:#fff;font-size:16px;cursor:pointer}
.fx .lbtn::before{content:"";position:absolute;left:20px;top:50%;width:16px;height:16px;margin-top:-8px;border-radius:50%;border:2px solid rgba(255,255,255,.3);border-top-color:#fff;animation:kfx-spin 1s linear infinite;opacity:0}
.fx .lbtn.busy{pointer-events:none;opacity:.8}
.fx .lbtn.busy::before{opacity:1}
@keyframes kfx-spin{to{transform:rotate(360deg)}}

HTML 结构

HTML
<div class="fx">
<button class="lbtn" onclick="this.classList.add('busy');this.textContent='提交中…';setTimeout(()=>{this.classList.remove('busy');this.textContent='点我提交'},2000)">点我提交</button>
</div>
实现要点:加载圈 = 单边 border + linear 无限旋转;class 切换文字与禁用态

其它按钮类特效

回到 前端Wiki 首页 · CSS 特效合集