CSS Toast Notification
A compact success toast that slides up and fades in when it appears.
Changes saved
HTML
<div class="toast-ok" role="status">
<span aria-hidden="true">✓</span>
Changes saved
</div>
CSS
.toast-ok {
display: inline-flex;
align-items: center;
gap: 10px;
padding: 12px 18px 12px 12px;
border-radius: 12px;
background: #18181b;
box-shadow: 0 12px 28px -10px rgba(0, 0, 0, 0.5);
color: #fafafa;
font: 500 14px/1 system-ui, sans-serif;
animation: toast-in 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.toast-ok span {
display: grid;
place-items: center;
width: 22px;
height: 22px;
border-radius: 50%;
background: #22c55e;
color: #052e16;
font-weight: 800;
}
@keyframes toast-in {
from { opacity: 0; transform: translateY(16px) scale(0.96); }
}
@media (prefers-reduced-motion: reduce) {
.toast-ok { animation: none; }
}
About this CSS Toast Notification
This CSS Toast Notification is 31 lines of pure CSS (0.7 KB) with no JavaScript and no dependencies. It uses keyframe animations, transforms, box shadows and CSS Grid. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.
CSS features used
Customize it
The colors in this snippet. Search and replace them to match your brand:
#18181b#fafafa#22c55e#052e16
How to use this toast notification
- Copy the HTML and paste it where you want the element to appear.
- Copy the CSS into your stylesheet, or inside a
<style>tag. - Keep the
.toast-okclass name, or rename it in both places. Then tweak colors, sizes and timing to match your design. - Using React or Next.js? Change
classtoclassNamein the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).
Building with an AI tool?
“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.