中文
正在发送
Loading & status · CSS only

Loading dots

三点弹跳加载

Three small dots hop up one after another to show something is loading.

Also searched as: 三个小点依次跳动表示加载中, 加载时三个点上下跳, 等待时的跳动小圆点, 按钮里转圈的替代:三个跳动的点

AI Markdown (.md)
Placement
Button, Page transition
Mood
Playful, Crisp
Trigger
一直循环
Site types
个人网站, 工具和应用

How it works & accessibility

Each dot rises to its peak at 40% of the loop and lands at 80% with ease-in-out segments, the second and third start 16% and 32% of a loop later, dots follow the text color, the wrapper is a labelled role=status, and reduced motion leaves three still, half-transparent dots.

Best for: Button, Page transition (一直循环).

Reduced motion: 不跳,三个点静止、半透明(照样说明在加载)

Mobile & touch: 和桌面一样;按钮里用的话,跳的高度别超过按钮上下的留白

Key parameters

ParameterKeyDefaultRangeNotes
一圈多久duration1000ms——
跳多高lift10px——

Ready-to-paste AI prompt

Add “Loading dots” to the button in my project: Each dot rises to its peak at 40% of the loop and lands at 80% with ease-in-out segments, the second and third start 16% and 32% of a loop later, dots follow the text color, the wrapper is a labelled role=status, and reduced motion leaves three still, half-transparent dots.
Parameters: duration: 1000ms, lift: 10px.
Preserve existing content and layout. Respect prefers-reduced-motion by showing the final state. Content must remain visible if JavaScript fails or is disabled.
Reference: https://donglang.linter.top/effects/loading-dots.md (canonical specification and reference code).

Dependency-free reference code

CSS
/* 三点弹跳加载(Loading dots)· 只用 CSS,不需要脚本。三个小圆点一个接一个地往上跳,表示正在加载。
   参考 StyleKit 的 spinner-dots、Animation Handbook 的 loading-spinner 的做法(都是 MIT),自己实现,没有复制代码。
   用法:<span class="ld" role="status"><i></i><i></i><i></i><span class="ld-label">加载中</span></span>,放在按钮里、文字后面都行。
   - 三个点是装饰;外框是 role="status",里面那段 .ld-label 是只给读屏的文字(看不见、读屏念得到,换语言就换这句);
     加载完把整个 .ld 拿掉。只写 aria-label 不够:role="status" 念的是里面的文字。
   - 放在按钮里时,读屏通常只把这句话算进按钮的名字("正在发送 加载中"),不会另外播报;要单独播报,把 .ld 放在按钮外面的状态区里。
   - 每个点一圈里 40% 时跳到最高(--ld-lift)、80% 落回原处、剩下的时间停着,每一段都是 ease-in-out;
     第 2、3 个点比前一个晚 16% 圈,看起来一个接一个地跳。只动位移,不挤动旁边的字。
   - 点的大小跟着字号(0.5em),颜色跟着文字颜色(currentColor)。
   - --ld-duration:一圈多久;--ld-lift:跳多高(按钮里用的话,别超过按钮上下的留白)。
   - 开启"减少动态"时:不跳,三个点静止、半透明(照样说明在加载)。 */
/* 默认值写在 :where() 里(不占优先级):网站自己在 .ld 上改的变量,不管写在这段代码前面还是后面,都用网站自己的 */
:where(.ld) {
  --ld-duration: 1000ms;
  --ld-lift: 10px;
}
.ld {
  display: inline-flex;
  gap: 0.35em;
  align-items: center;
}
.ld > i {
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: currentColor;
  animation: ld-bounce var(--ld-duration) ease-in-out infinite;
}
.ld > i:nth-child(2) {
  animation-delay: calc(var(--ld-duration) * 0.16);
}
.ld > i:nth-child(3) {
  animation-delay: calc(var(--ld-duration) * 0.32);
}
/* 只给读屏的文字:看不见、不占位置,读屏照样念 */
.ld-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@keyframes ld-bounce {
  0%, 80%, 100% { translate: 0 0; }
  40% { translate: 0 calc(var(--ld-lift) * -1); }
}
@media (prefers-reduced-motion: reduce) {
  .ld > i {
    animation: none;
    opacity: 0.5;
  }
}
HTML
<!-- 三点弹跳加载:放在按钮里、文字后面都行;.ld-label 是只给读屏的文字;加载完把整个 .ld 拿掉 -->
<button type="submit" aria-busy="true">
  正在发送
  <span class="ld" role="status"><i></i><i></i><i></i><span class="ld-label">加载中</span></span>
</button>

More in Loading & status

Browse all 86 effects →

Shown once per release · Always available in changelog