CSS Notification Badge
A bell icon button with an unread-count badge that rings on hover.
<button class="notify-bell" aria-label="3 notifications">
<svg viewBox="0 0 24 24"><path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/></svg>
<span class="notify-bell-count">3</span>
</button>
.notify-bell {
position: relative;
display: grid;
place-items: center;
width: 48px;
height: 48px;
border: 1px solid #e5e7eb;
border-radius: 14px;
background: #fff;
cursor: pointer;
}
.notify-bell svg {
width: 22px;
height: 22px;
fill: none;
stroke: #111;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
transform-origin: top center;
}
.notify-bell:hover svg {
animation: notify-bell-ring 0.6s ease;
}
.notify-bell-count {
position: absolute;
top: -6px;
right: -6px;
box-sizing: border-box;
min-width: 20px;
height: 20px;
padding: 0 5px;
border: 2px solid #fff;
border-radius: 999px;
background: #ef4444;
color: #fff;
font: 700 11px/16px system-ui, sans-serif;
text-align: center;
}
@keyframes notify-bell-ring {
20% { transform: rotate(14deg); }
40% { transform: rotate(-12deg); }
60% { transform: rotate(8deg); }
80% { transform: rotate(-4deg); }
}
@media (prefers-reduced-motion: reduce) {
.notify-bell:hover svg {
animation: none;
}
}
About this CSS Notification Badge
This CSS Notification Badge is 55 lines of pure CSS (1.0 KB) with no JavaScript and no dependencies. It uses keyframe animations, transforms, CSS Grid and reduced-motion support. 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:
#e5e7eb#fff#111#ef4444
How to use this notification badge
- 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
.notify-bellclass 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.