07숫자 카운트 로딩
자바스크립트 없이 @property 로 등록한 숫자 변수가 0에서 100까지 올라가며 counter() 로 화면에 찍히고, 그 위에 얇은 링이 같은 속도로 채워져 숫자와 게이지가 정확히 맞물립니다.
쓰임리소스 프리로드 퍼센트, 앱 초기화 진행 표시
@propertycounter()linear

<main class="stage">
<div class="cu-box is-demo" role="status">
<span class="cu-sr-only">로딩 중</span>
<div class="cu-ring" aria-hidden="true"></div>
<span class="cu-num" aria-hidden="true"></span>
</div>
</main>@use "../../../../site/static/demo-tokens" as *;
// ── 변수 3개 ──────────────────────────────────────────
$duration: 2s;
$easing: linear;
$color: $subject-cream;
@include stage($stage-orange);
// 숫자 변수를 등록해야 애니메이션과 counter() 로 쓸 수 있다 (JS 없음)
@property --n {
syntax: "<integer>";
inherits: true;
initial-value: 0;
}
.cu-box {
position: relative;
width: 170px;
height: 170px;
display: grid;
place-items: center;
--n: 0;
}
.cu-sr-only {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
}
.cu-ring {
position: absolute;
inset: 0;
border-radius: 50%;
background: conic-gradient($color calc(var(--n) * 1%), rgba(23, 20, 26, .45) 0);
mask: radial-gradient(farthest-side, #0000 calc(100% - 20px), #000 calc(100% - 19px));
}
.cu-num {
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
font-size: 56px;
font-weight: 800;
line-height: 1;
color: $color;
counter-reset: n var(--n);
}
.cu-num::after {
content: counter(n) "%";
}
// 실사용: 로딩 중에만 .is-loading — 숫자와 링이 같은 변수를 읽어 정확히 맞물린다
.cu-box.is-loading,
.cu-box.is-demo {
animation: cu-count $duration $easing infinite;
}
@keyframes cu-count {
from { --n: 0; }
to { --n: 100; }
}
@media (prefers-reduced-motion: reduce) {
.cu-box.is-loading,
.cu-box.is-demo {
animation: none !important;
--n: 100 !important; // 100% 에 멈춘 모양
}
}html, body {
margin: 0;
overflow: hidden;
}
.stage {
box-sizing: border-box;
min-height: 100vh;
display: grid;
place-items: center;
margin: 0;
background: #ff4d1f;
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
padding: clamp(8px, 4vw, 24px);
}
@property --n {
syntax: "<integer>";
inherits: true;
initial-value: 0;
}
.cu-box {
position: relative;
width: 170px;
height: 170px;
display: grid;
place-items: center;
--n: 0;
}
.cu-sr-only {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
}
.cu-ring {
position: absolute;
inset: 0;
border-radius: 50%;
background: conic-gradient(#fff7e6 calc(var(--n) * 1%), rgba(23, 20, 26, 0.45) 0);
mask: radial-gradient(farthest-side, rgba(0, 0, 0, 0) calc(100% - 20px), #000 calc(100% - 19px));
}
.cu-num {
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
font-size: 56px;
font-weight: 800;
line-height: 1;
color: #fff7e6;
counter-reset: n var(--n);
}
.cu-num::after {
content: counter(n) "%";
}
.cu-box.is-loading,
.cu-box.is-demo {
animation: cu-count 2s linear infinite;
}
@keyframes cu-count {
from {
--n: 0;
}
to {
--n: 100;
}
}
@media (prefers-reduced-motion: reduce) {
.cu-box.is-loading,
.cu-box.is-demo {
animation: none !important;
--n: 100 !important;
}
}import { CSSProperties } from "react";
import styles from "./CountUpNumber.module.scss";
type Vars = CSSProperties & {
"--duration"?: string;
"--easing"?: string;
"--color"?: string;
};
export interface CountUpNumberProps {
duration?: string;
easing?: string;
color?: string;
/** 화면에 표시할 짧은 안내 문구 (스크린리더용) */
label?: string;
}
export default function CountUpNumber({
duration = "2s",
easing = "linear",
color = "#fff7e6",
label = "Loading",
}: CountUpNumberProps) {
const style: Vars = {
"--duration": duration,
"--easing": easing,
"--color": color,
};
return (
<div className={styles.box} style={style} role="status">
<span className={styles.srOnly}>{label}</span>
<div className={styles.ring} aria-hidden="true" />
<span className={styles.num} aria-hidden="true" />
</div>
);
}07 숫자 카운트 로딩 — 측정 누적면적 9.245% · 움직인 프레임 23/23GODRICH 원작 · zip 에 SCSS·React 포함 · 로딩페이지 디자인 9종 — 복붙하는 예쁜 CSS 로딩 화면
이 데모가 속한 글
로딩페이지 디자인 9종 — 복붙하는 예쁜 CSS 로딩 화면로딩페이지 디자인은 서비스가 켜지는 첫 순간에 사용자에게 "기다리고 있네"라고 말해주는 화면입니다. 기본 스피너 하나로도 되지만, 파스텔 링이나 차오르는 물처럼 예쁜 로딩 화면은 복붙 몇 줄로 사이트 인상을 바꿔 놓 이 글의 데모 전부 보기


