30 CSS Notifications
30 hand-coded CSS notification topics, each shipping 2–3 side-by-side variants so you can pick the exact treatment for your surface — transient toast confirmations, persistent badge counters on icons, sticky announcement banners, expandable notification panels, and browser push-style popups. Modern @starting-style + transition-behavior: allow-discrete + role="status" / role="alert" semantics throughout so notifications communicate without motion perception AND without interrupting keyboard/screen-reader users. Scoped under .ntf-NN for no-collision pasting, prefers-reduced-motion guarded, framework-agnostic.
Related20 CSS Empty States20 CSS Banners & Alerts30 CSS Badges36 CSS Modals15 CSS Chat Bubbles25 Tailwind CSS FAQ Accordion
Premium icon pickPartner: Nucleo
Affiliate linkNeed icons for the components you just copied?
You just browsed 30 notifications. Nucleo is a library of 44,000+ SVG icons in five families (Core, UI, Sharp, Pixel and Micro Bold), with web, Mac and Windows apps to manage them. The All Icons Bundle is $149 with lifetime updates.
Nucleo. We may earn a commission, at no extra cost to you.
02. Pure CSS Toast Notification Auto Dismiss (opens in a new tab)
03. CSS Toast Progress Bar Countdown (opens in a new tab)
04. Stacked Toast Notifications CSS Flexbox (opens in a new tab)
05. Dark Mode Toast Notification CSS (opens in a new tab)
06. Glassmorphism Toast Notification CSS (opens in a new tab)
07. CSS Success Error Warning Info Alert Toasts (opens in a new tab)
08. Tailwind CSS Toast Popup Snippet (opens in a new tab)
09. CSS Notification Badge With Count on Icon (opens in a new tab)
10. Pulsing Notification Dot CSS Animation (opens in a new tab)
11. CSS Avatar Notification Badge (opens in a new tab)
12. CSS Shopping Cart Item Count Badge (opens in a new tab)
13. CSS Notification Badge Clip Path (opens in a new tab)
14. CSS Pinging Pulse Badge Animation (opens in a new tab)
15. Sticky Top Notification Banner CSS (opens in a new tab)
16. CSS Notification Banner With Close Button (opens in a new tab)
17. Floating Bottom Alert Bar CSS (opens in a new tab)
18. CSS Alert Box Success Error Styles (opens in a new tab)
19. CSS Subtle System Status Banner (opens in a new tab)
<marquee> tag), and a status-page strip that cycles operational → degraded → maintenance with a breathing dot, cross-fading copy and a live 'checked Ns ago' counter.20. CSS Animated Notification Bell Hover (opens in a new tab)
21. Pure CSS Notification Toggle Switch (opens in a new tab)
22. Expandable Notification Panel CSS (opens in a new tab)
<details> notification center whose open/close animates through ::details-content + allow-discrete (zero JS, state included), and a popover-API panel that lives in the top layer — light-dismiss, Esc-to-close and focus handling free — scaling in from the bell via @starting-style with a tiny position sync.23. CSS Bounce Notification Animation (opens in a new tab)
24. CSS Sweet Alert Style Animated Icons (opens in a new tab)
25. Accessible CSS Toast Notification Aria Live (opens in a new tab)
26. CSS Notification Card With Action Buttons (opens in a new tab)
27. Responsive Full Width Mobile Notification Bar (opens in a new tab)
28. CSS Push Notification Browser Style Popup (opens in a new tab)
29. CSS Timeline Alert Feed Component (opens in a new tab)
<time> stamps, an unread divider and staggered entry — and a day-grouped scrolling feed where each date header position:stickies inside the panel and hands off to the next, the pattern every activity log ships.30. CSS Floating Feedback Button With Badge (opens in a new tab)
Frequently asked questions
What is a CSS notification and what is the canonical toast recipe?
.toast { position: fixed; bottom: 24px; right: 24px; padding: 14px 18px; background: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.15); border-radius: 12px; opacity: 0; transform: translateY(10px); transition: opacity .25s, transform .25s; } .toast.show { opacity: 1; transform: translateY(0); }. The critical details most tutorials get wrong: (1) animate transform + opacity only — NEVER top/bottom, those trigger layout thrash and adjacent elements jump; (2) use position: fixed not absolute, so the toast sticks to the viewport regardless of scroll position; (3) force GPU compositor promotion with transform: translate3d(0,0,0) or will-change: transform; (4) auto-dismiss via setTimeout paired with an animationend-based re-arm pattern (never the deprecated void-offsetWidth reflow hack); (5) wrap in @media (prefers-reduced-motion: reduce) { .toast { transition: none; opacity: 1; transform: none; } } — the WCAG 2.3.3 requirement. Modern extras (Chrome 116+, Safari 17+): @starting-style + transition-behavior: allow-discrete let you animate display: none → block for enter/exit without any JS class-toggle at all. Every demo in this collection uses one of these patterns.Which notification pattern should I pick for my use case — toast vs badge vs banner vs modal?
Notification.requestPermission() + user grant. Use sparingly; too many kills your permission trust. Rule of thumb: if the user is looking at the screen and the info is helpful-but-not-critical → toast. If they need to know it every time they visit → badge. If it affects the whole product experience → banner. If they can't continue without responding → modal. If they might not be looking at the screen at all → push.Toast accessibility — role='status' vs role='alert' vs aria-live='polite' vs 'assertive'?
role="status" (implicit aria-live="polite"): screen reader announces the content AFTER the user's current speech finishes. Use for non-urgent updates — 'Saved', 'Message sent', 'Cart updated'. Never interrupts the user mid-task. This is the RIGHT choice for 95% of toasts. Pattern: <div class="toast" role="status">Message sent</div>. 2. role="alert" (implicit aria-live="assertive"): screen reader interrupts whatever the user is currently doing to announce the content immediately. Use ONLY for urgent info the user must act on RIGHT NOW — 'Session expiring in 30 seconds', 'Connection lost — changes not saved', 'Payment failed — try again'. Never for confirmations. Overusing role="alert" is the digital equivalent of a car alarm that goes off every 5 minutes — users learn to ignore it. Pattern: <div class="toast toast--urgent" role="alert">Connection lost</div>. Critical implementation detail: for the announcement to actually fire, the element must be in the DOM BEFORE the message text is set. Adding <div role="status">Saved!</div> to the DOM in one step does NOT announce reliably — screen readers only announce CHANGES to already-existing live regions. Correct pattern: (1) render an empty <div role="status" aria-live="polite"></div> on page load; (2) later, populate its textContent. The change fires the announcement. Every toast demo in this collection uses this pattern. Also: pair the ARIA with visual signals — icon + color + text, never color alone (WCAG 1.4.1 Use of Color). Every regulatory framework — US ADA, Section 508, EU EAA (June 2025 enforcement), Canada ACA, UK Equality Act, Australian DDA — treats notification accessibility failures as WCAG 2.2 AA violations. Topic 25 (Accessible CSS Toast Notification Aria Live) is the reference implementation.How do I prevent Cumulative Layout Shift (CLS) with notifications?
position: fixed always. The toast lives on a separate layer above the page flow; the page layout never sees it. 2. Banner appearing at the top of the page after paint: cookie consent banner mounted via JS after hydration → all page content jumps down by the banner's height. Fix: server-render the banner (Astro SSG or Next.js) so it exists in the initial HTML, OR reserve space with a placeholder <div style="height: 60px"></div> that gets replaced by the banner on hydration. 3. Notification badge causing icon to shift: badge overlays the icon using absolute positioning inside a wrapper that grows when the badge appears. Fix: position: absolute on the badge inside a position: relative icon-container of fixed size; the wrapper dimensions are set by the icon, badge overlays without affecting layout. 4. Expanding notification panel: click bell → panel drops down → content below jumps. Fix: overlay the panel with position: absolute above the content (like a dropdown), or animate content shift via height with interpolate-size: allow-keywords (Chrome 129+) which is a compositor-only animation. 5. Web font swap on the toast: FOUT (Flash of Unstyled Text) mid-animation. Fix: font-display: optional on the toast's font-face rule OR font-display: swap + set explicit width on the toast so the swap doesn't reflow. Tools: Chrome DevTools Performance panel (Layout Shift detail), Lighthouse, PageSpeed Insights, Web Vitals Chrome extension, Core Web Vitals report in Google Search Console. Every notification demo in this collection is CLS-safe by construction — position: fixed for toasts/banners, dimensioned wrappers for badges, overlay-not-push for panels.CSS notifications vs react-toastify vs Sonner vs SweetAlert vs Notyf — how do they compare?
shadcn Toast + MUI Snackbar + Chakra useToast + Mantine notifications — how do these compare?
toast('Saved')), promise-based (toast.promise(fetchData(), { loading, success, error })), stackable, elegant defaults. Uses Radix Toast primitive under the hood. Copy-paste into your project via npx shadcn@latest add sonner. Best-in-class for React + shadcn stacks. MUI Snackbar (~15KB when tree-shaken from MUI's 100KB+ full bundle): the OG Material Design toast. Verbose API (<Snackbar open={open} autoHideDuration={6000} onClose={handleClose}><Alert severity="success">...</Alert></Snackbar>), but comprehensive — every position, severity, action button pattern. Overkill for simple confirmations; correct for enterprise UIs already invested in MUI. Chakra UI useToast: React hook returning a toast() function. Chakra ships toast as core — no separate install. Solid choice for Chakra projects. Mantine notifications (@mantine/notifications, ~10KB): imperative API (notifications.show({ title, message })), auto-stacking, positioned queues. Excellent DX; requires Mantine's provider setup. Ant Design notification: static method notification.success({ message, description }). Popular in enterprise / dashboard products. Heavy (~40KB+ from AntD). HeadlessUI / Radix Toast: unstyled primitives — you bring your own CSS. Every demo in this collection is essentially a HeadlessUI/Radix-compatible styling layer you can drop under any of these libraries' primitives. What this collection gives you: the CSS half. Every one of these libraries handles state, positioning, stacking logic well — but their default visual styles are generic. Compose our pure-CSS animations, badges, banners, and icon transitions with any of these libraries' state machines to get production-grade visual polish without abandoning the library's ergonomics. Recipe for each library included in the demo's customization field.Web Push Notification API vs CSS-based in-app notifications — when to use each?
Notification.requestPermission() call → user must grant, (4) backend that sends push messages via Firebase Cloud Messaging (FCM), Apple Push Notification service (APNs), or a service like OneSignal / Pusher. When to use Web Push: news alerts, chat messages, order status updates, calendar reminders, e-commerce back-in-stock alerts — anything the user needs to know when they're not on your site. iOS Safari caveat: as of iOS 16.4 (March 2023), Safari supports Web Push — but ONLY for PWAs (installed apps). A regular Safari tab CANNOT request Web Push permission on iOS. This is Apple policy, no workaround. Android / desktop have no such restriction. Permission UX best practice: never call requestPermission() on page load — 99% of users deny, and denials are STICKY (browser remembers 'deny' and won't re-prompt for weeks/months). Instead: (1) explain WHY you want to send notifications in an in-app UI first (use one of this collection's toast or banner patterns — topic 28's push-notification-style popup is designed exactly for this pre-prompt UX), (2) request permission ONLY after user says 'Yes, I want notifications', (3) if denied, respect it — never re-prompt in the same session. Combining both: real products use both. In-app notifications (this collection) for foreground state changes. Web Push for background notifications when the user isn't on the site. The visual style for the Web Push notification is controlled by the OS, not you — but the pre-prompt permission-request UI is 100% yours to design (topic 28 is the canonical pattern). Alternatives to Web Push: email, SMS, native mobile push (via a React Native / Flutter wrapper), Slack/Discord webhooks — pick based on your users' habits.Real-time notification feed architecture — how do the CSS animations connect to the backend?
new EventSource(url). Use for one-way push (notifications, live feeds, progress updates). (c) Polling: client calls fetch(/api/notifications/unread) every N seconds. Simplest infra, worst battery/network. Use when latency >30s is OK (email-like notifications). 3. Browser receives event → dispatches to notification UI: your JS listener converts the event payload into an in-app notification. Pattern with topic 04 (Stacked Toast Notifications): socket.on('notification', (msg) => { const toast = document.createElement('div'); toast.className = 'ntf-04a__toast'; toast.textContent = msg.text; document.querySelector('.ntf-04a__stack').prepend(toast); setTimeout(() => toast.remove(), 5000); });. The CSS handles the enter animation (@starting-style + transition: transform, opacity); JS handles append + remove. 4. Persistence + read state: unread notifications persist in your database. When user views the notification panel, mark as read via a PATCH call. Badge count on the bell icon (topic 09) subscribes to the same event stream to increment / decrement in real time. 5. Offline handling: WebSocket connections drop when the user goes offline. Handle reconnection + replay of missed events. Libraries above handle this automatically; polling handles it by design. Recommended stack for a mid-size SaaS in 2027: Supabase Realtime OR PartyKit for the transport layer, this collection for the visual layer, IntersectionObserver for read-state detection when the user scrolls past a notification. The full pattern is production-tested at Linear, Notion, Slack, GitHub, Discord.Related collections
30 CSS Badges
30 hand-coded CSS badges for status indicators, notifications, membership tiers, live-data displays, and SEO / DevOps / financial dashboards — upload progress, typing indicator, transit line status, Core Web Vitals, ECG heartbeat, CI/CD build pipeline, countdown ring, live price ticker, keycap shortcut, wax seal, conference lanyard, and holographic collectibles. Copy-paste HTML and CSS, WCAG 2.2 accessible, MIT licensed.
20 CSS Banners & Alerts
20 hand-coded CSS banner and alert bars for e-commerce storefronts, SaaS dashboards, marketing sites, and compliance-bound products. Covers GDPR cookie consent with a real preferences panel, promo bars with countdown timers, free-shipping threshold progress, app-install smart banners, maintenance and incident status bars, newsletter signup bars, age verification gates, limited-stock urgency banners, live event announcements, browser upgrade notices, geo and currency switchers, sticky top announcement bars, bottom cookie bars, inline form validation alerts, icon-aligned alert banners, left-border accent alerts, diagonal stripe promos, full-width hero banners, animated gradient border alerts, and a text-wrapping laboratory that shows five strategies for the unbreakable string that breaks more banners than anything else. Every bar is scoped under a .ba-NN prefix for no-collision pasting, guards prefers-reduced-motion, carries the correct aria-live and role semantics, and ports unchanged to React, Vue, Svelte, Astro, Next.js and Tailwind.
25 CSS Blockquotes
25 CSS blockquotes for article pull quotes, testimonial cards, docs callout admonitions, statement banners, and social-post embeds. Covers giant decorative quotation marks, minimalist hairline and classic left borders, animated gradient and glowing neon borders, glassmorphism and aurora backgrounds, brutalist cards, speech bubbles, thick accent rails, highlighted mark text, newspaper multi-column layouts, an expandable read-more disclosure, a scroll-snap testimonial slider, and one-click copy.


























