CSS Ringing Bell
A notification bell that swings now and then to draw the eye, with an unread count badge.
<button class="ringing-bell" aria-label="Notifications, 3 unread">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M12 3a6 6 0 0 0-6 6v4l-2 3h16l-2-3V9a6 6 0 0 0-6-6Z"/>
<path d="M10 19a2 2 0 0 0 4 0"/>
</svg>
<span>3</span>
</button>
.ringing-bell {
position: relative;
display: grid;
place-items: center;
width: 52px;
height: 52px;
border: 0;
border-radius: 14px;
background: #fff;
box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.3);
cursor: pointer;
}
.ringing-bell svg {
width: 26px;
height: 26px;
fill: none;
stroke: #0f172a;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
transform-origin: 50% 10%;
animation: ringing-bell-swing 2.4s ease-in-out infinite;
}
.ringing-bell span {
position: absolute;
top: 6px;
right: 6px;
box-sizing: border-box;
min-width: 18px;
height: 18px;
padding: 0 5px;
border-radius: 999px;
background: #ef4444;
box-shadow: 0 0 0 2px #fff;
color: #fff;
font: 700 11px/18px system-ui, sans-serif;
}
.ringing-bell:focus-visible {
outline: 2px solid #6366f1;
outline-offset: 2px;
}
@keyframes ringing-bell-swing {
0%, 35%, 100% { transform: rotate(0); }
5% { transform: rotate(18deg); }
10% { transform: rotate(-16deg); }
15% { transform: rotate(12deg); }
20% { transform: rotate(-8deg); }
25% { transform: rotate(4deg); }
}
@media (prefers-reduced-motion: reduce) {
.ringing-bell svg { animation: none; }
}
About this CSS Ringing Bell
This CSS Ringing Bell is 57 lines of pure CSS (1.2 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:
#fff#0f172a#ef4444#6366f1
How to use this ringing bell
- 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
.ringing-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.