인라인 알림Inline alert
내용 사이에 자리를 차지하고 머무르는 알림 상자예요. 저절로 사라지지 않아서, 실패나 주의처럼 사용자가 읽고 뭔가 해야 하는 소식에 맞아요.
이럴 때 써요
- 업로드 실패, 결제 거절처럼 사용자가 다시 시도해야 할 때
- 저장 공간 부족, 곧 끝나는 기간처럼 미리 알아야 할 주의
- 새 기능 안내처럼 그 화면에서만 의미 있는 소식
이럴 땐 다른 걸 써요
- 성공을 잠깐 알리면 → 토스트
- 지금 당장 결정을 받아야 하면 → 확인 대화상자
- 입력 칸 하나의 오류라면 → 그 칸 바로 아래 한 줄 오류 문구
무엇으로 이루어지나
- 상태 색 동그라미 아이콘(정보·주의·위험)
- 굵은 제목 한 줄
- 이유와 해결 방법 설명
- 해결 단추(다시 시도 등, 선택)
- 닫기 단추(선택)
잘 만드는 요령
- 색만으로 구분하지 말고 아이콘 모양도 달리해요(동그라미 i, 세모 !, 동그라미 !). 색을 구분하기 어려운 사람도 알아볼 수 있어요.
- 상자 전체를 진한 색으로 칠하지 말고, 아이콘 뒤 옅은 원에만 상태 색을 써요. 여러 개가 있어도 화면이 시끄럽지 않아요.
- 실패 알림에는 "무엇이 안 됐는지 + 어떻게 하면 되는지"를 함께 적어요. "오류가 발생했습니다"만 쓰면 아무도 못 고쳐요.
- 해결 단추를 누르면 같은 자리에서 상태를 바꿔 보여 줘요(실패 → 진행 중 → 성공). 알림이 사라졌다 다시 뜨면 무슨 일인지 놓쳐요.
AI 에게 시키는 프롬프트
Claude·ChatGPT 에 붙여 넣으면 위 데모와 비슷한 화면을 HTML 파일 하나로 만들어 줘요. 글자·색은 바꿔 쓰세요.
세로로 쌓인 인라인 알림 3개를 만들어 줘: 정보(파랑, 동그라미 i 아이콘) "즐겨찾기를 폴더로 묶을 수 있어요", 주의(주황, 세모 ! 아이콘) "저장 공간이 90% 찼어요", 위험(빨강, 동그라미 ! 아이콘) "파일을 올리지 못했어요 — 인터넷 연결을 확인하고 다시 시도해 주세요". 상자는 흰 카드(모서리 20px, 아주 옅은 그림자)이고 상태 색은 아이콘 뒤 옅은 원에만 써. 각 상자에 닫기 단추(누르면 150ms 로 흐려지며 사라짐). 위험 알림에는 "다시 시도" 단추가 있고, 누르면 같은 자리에서 "다시 올리는 중…"(1.2초) 뒤 초록 성공 알림 "올렸어요"로 바뀌어. 조건: HTML 파일 하나에 CSS·자바스크립트를 함께 넣고 외부 라이브러리는 쓰지 마. 움직임은 transform·opacity 만 쓰고, prefers-reduced-motion 이 켜져 있으면 움직임을 끄고 결과만 보여 줘. 밝은 화면과 어두운 화면(prefers-color-scheme) 둘 다 맞추고, 폰 폭 320px 에서도 깨지지 않게. 키보드로도 쓸 수 있게 하고 포커스 링이 보이게 해 줘. 강조색은 파랑(#0485F7), 글꼴은 Pretendard.
HTML 코드
위 데모를 돌리는 코드 그대로예요. 파일 하나로 저장해 브라우저로 열면 바로 움직여요. 자유롭게 고쳐 써도 돼요.
코드 펼쳐 보기
<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>인라인 알림 — 유틸픽 디자인픽</title>
<style>
/* 바탕 — 밝은 화면 기본, 기기 설정이 어두우면 어두운 화면. <html class="dark"> 나 "light" 로 고정할 수 있어요. */
:root{color-scheme:light;--bg:#f7f7f8;--surface:#ffffff;--surface-2:#f0f0f2;--surface-3:#e6e6ea;--fg:#18181b;--muted:#6b6b76;--border:#e4e4e7;
--accent:#0485f7;--accent-hover:#2b97f8;--accent-fg:#fcfcfc;--accent-soft:rgba(4,133,247,.14);--accent-soft-fg:#1e63ae;
--success:#12a150;--success-soft:rgba(18,161,80,.14);--success-soft-fg:#0e7a3d;
--warning:#e8930c;--warning-soft:rgba(245,165,36,.18);--warning-soft-fg:#8a5300;
--danger:#e5484d;--danger-soft:rgba(229,72,77,.14);--danger-soft-fg:#b4232a;
--shadow-surface:0 2px 4px rgba(0,0,0,.04),0 1px 2px rgba(0,0,0,.06),0 0 1px rgba(0,0,0,.06);
--shadow-float:0 2px 8px rgba(0,0,0,.06),0 -6px 12px rgba(0,0,0,.03),0 14px 28px rgba(0,0,0,.08);
--shine:rgba(255,255,255,.65);
--ease:cubic-bezier(.32,.72,0,1);}
@media (prefers-color-scheme:dark){:root:not(.light){color-scheme:dark;--bg:#0e0e11;--surface:#1b1b20;--surface-2:#25252b;--surface-3:#303037;--fg:#fafafa;--muted:#a1a1aa;--border:#2e2e35;
--accent:#0485f7;--accent-hover:#2b97f8;--accent-fg:#fcfcfc;--accent-soft:rgba(4,133,247,.2);--accent-soft-fg:#61a8fc;
--success:#17c964;--success-soft:rgba(23,201,100,.16);--success-soft-fg:#5fe39a;
--warning:#f5a524;--warning-soft:rgba(245,165,36,.16);--warning-soft-fg:#f7c26b;
--danger:#f2555a;--danger-soft:rgba(242,85,90,.16);--danger-soft-fg:#ff8a8e;
--shadow-surface:inset 0 0 0 1px rgba(255,255,255,.06);
--shadow-float:inset 0 0 0 1px rgba(255,255,255,.12),0 14px 28px rgba(0,0,0,.45);
--shine:rgba(255,255,255,.07);}}
:root.dark{color-scheme:dark;--bg:#0e0e11;--surface:#1b1b20;--surface-2:#25252b;--surface-3:#303037;--fg:#fafafa;--muted:#a1a1aa;--border:#2e2e35;
--accent:#0485f7;--accent-hover:#2b97f8;--accent-fg:#fcfcfc;--accent-soft:rgba(4,133,247,.2);--accent-soft-fg:#61a8fc;
--success:#17c964;--success-soft:rgba(23,201,100,.16);--success-soft-fg:#5fe39a;
--warning:#f5a524;--warning-soft:rgba(245,165,36,.16);--warning-soft-fg:#f7c26b;
--danger:#f2555a;--danger-soft:rgba(242,85,90,.16);--danger-soft-fg:#ff8a8e;
--shadow-surface:inset 0 0 0 1px rgba(255,255,255,.06);
--shadow-float:inset 0 0 0 1px rgba(255,255,255,.12),0 14px 28px rgba(0,0,0,.45);
--shine:rgba(255,255,255,.07);}
*{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0;min-height:100vh;display:grid;place-items:center;padding:24px;background:var(--bg);color:var(--fg);
font:15px/1.5 Pretendard,-apple-system,BlinkMacSystemFont,system-ui,'Apple SD Gothic Neo',sans-serif;-webkit-font-smoothing:antialiased;word-break:keep-all}
button{font:inherit;color:inherit}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:40px;padding:0 16px;border:0;border-radius:999px;
background:var(--surface-2);color:var(--fg);font-size:14px;font-weight:600;cursor:pointer;
transition:transform .25s ease,background-color .1s ease-out}
.btn:active{transform:scale(.97)}
.btn-primary{background:var(--accent);color:var(--accent-fg)}
.btn-danger{background:var(--danger);color:#fff}
@media (hover:hover){.btn:hover{background:var(--surface-3)}.btn-primary:hover{background:var(--accent-hover)}.btn-danger:hover{background:color-mix(in oklab,var(--danger) 90%,#fff)}}
.btn:disabled{opacity:.5;cursor:not-allowed;transform:none}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}
/* 인라인 알림 */
.stack{display:grid;gap:12px;width:min(440px,100%)}
.alert{--tone:var(--accent);--tone-soft:var(--accent-soft);display:flex;align-items:flex-start;gap:12px;padding:12px 8px 12px 14px;border-radius:20px;background:var(--surface);box-shadow:var(--shadow-surface);
transition:opacity .15s ease-out,transform .15s ease-out}
.alert[data-tone="warning"]{--tone:var(--warning);--tone-soft:var(--warning-soft)}
.alert[data-tone="danger"]{--tone:var(--danger);--tone-soft:var(--danger-soft)}
.alert[data-tone="success"]{--tone:var(--success);--tone-soft:var(--success-soft)}
.alert.gone{opacity:0;transform:scale(.98)}
.icon{flex:none;display:grid;place-items:center;width:30px;height:30px;border-radius:999px;background:var(--tone-soft);color:var(--tone)}
.body{flex:1;min-width:0;padding-top:4px}
.body strong{display:block;font-size:14px}
.body p{margin:2px 0 0;color:var(--muted);font-size:13.5px;line-height:1.55}
.retry{height:32px;margin-top:10px;padding:0 12px;font-size:13px}
.close{flex:none;display:grid;place-items:center;width:28px;height:28px;border:0;border-radius:999px;background:transparent;color:var(--muted);cursor:pointer}
@media (hover:hover){.close:hover{background:var(--surface-2)}}
</style>
</head>
<body>
<div class="stack">
<div class="alert" data-tone="info">
<span class="icon"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 11v5M12 8h.01"/></svg></span>
<div class="body"><strong>즐겨찾기를 폴더로 묶을 수 있어요</strong><p>별을 누른 도구를 길게 눌러 폴더로 옮겨 보세요.</p></div>
<button class="close" aria-label="알림 닫기"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg></button>
</div>
<div class="alert" data-tone="warning">
<span class="icon"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3.5 2.8 19.5h18.4z"/><path d="M12 10v4M12 17h.01"/></svg></span>
<div class="body"><strong>저장 공간이 90% 찼어요</strong><p>오래된 파일을 지우면 계속 저장할 수 있어요.</p></div>
<button class="close" aria-label="알림 닫기"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg></button>
</div>
<div class="alert" data-tone="danger" id="upload">
<span class="icon"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 7.5v5M12 16h.01"/></svg></span>
<div class="body" aria-live="polite"><strong>파일을 올리지 못했어요</strong><p>인터넷 연결을 확인하고 다시 시도해 주세요.</p><button class="btn retry" id="retry">다시 시도</button></div>
<button class="close" aria-label="알림 닫기"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg></button>
</div>
</div>
<template id="success-icon"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></template>
<template id="info-icon"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 11v5M12 8h.01"/></svg></template>
<script>
document.querySelectorAll('.close').forEach(function (button) {
button.addEventListener('click', function () {
const alert = button.closest('.alert');
alert.classList.add('gone');
setTimeout(function () { alert.remove(); }, 150);
});
});
document.getElementById('retry').addEventListener('click', function () {
const upload = document.getElementById('upload');
const body = upload.querySelector('.body');
body.innerHTML = '<strong>다시 올리는 중…</strong><p>잠깐만 기다려 주세요.</p>';
upload.dataset.tone = 'info';
upload.querySelector('.icon').replaceChildren(document.getElementById('info-icon').content.cloneNode(true));
setTimeout(function () {
upload.dataset.tone = 'success';
upload.querySelector('.icon').replaceChildren(document.getElementById('success-icon').content.cloneNode(true));
body.innerHTML = '<strong>올렸어요</strong><p>여행 사진.zip 이 내 보관함에 들어갔어요.</p>';
}, 1200);
});
</script>
</body>
</html>