Create a button with a notification bubble with CSS

Whether in a dashboard or for a notification system, a button displaying the number of events at a glance is a real must-have for your users' experience. Let's take a look at how to create one easily in this article.
•
Updated on August 14, 2026
•
2 min read
Believemy logo
In this article

Whether in a dashboard or for a notification system, a button displaying the number of events at a glance is truly a must-have for enhancing your users' experience. Let's explore together in this article how to create one easily.

Image

 

Step 1

Let's start with the HTML code.

HTML
<a href="#">
  Messages
  <span>3</span>
</a>

We simply add a link to our page. The span tag will be our notification bubble.

 

Step 2

Let's style the link and its hover effect.

CSS
a {
  position: relative;
  color: white;
  border: 2px solid #FF4754;
  text-decoration: none;
  padding: 1rem 2rem;
  border-radius: 4px;
  transition: all 0.2s;
}

a:hover {
  background-color: #FF4754;
}

In the previous step, we use Flexbox (display: flex) to center the content text in our notification bubble both horizontally and vertically.

We give it a 4px border of the page's background color to give the impression that the notification is not directly attached to the border of our button.

 

Step 3

Now, let's style the notification bubble.

CSS
a span {
  position: absolute;
  top: -1rem;
  right: -1rem;
  background: #FF4754;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid #121212;
  border-radius: 50%;
}

In the previous step, we use Flexbox to center the content text in our notification bubble both horizontally and vertically.

We give it a 4px border of the page's background color to give the impression that the notification is not directly attached to the border of our button.

Finally, we set our notification bubble's position: absolute to place it perfectly in the corner of our button.

Category: Developers

Share this article

Want to help us? Share this article on your networks or even better: on your site, in an article or in your newsletter.

Believemy logo
Comments (0)

You need to be logged in to comment on this article: log in or sign up.

Read next

Create an "architectural" design button using CSS

Creating a button where the borders split in two on hover may seem complicated, but nothing could be easier! Let's find out how in this article.

December 9, 2024

Create an animated 3D button using CSS

In this article, we'll find out how to create a three-dimensional button that will add a touch of softness and perspective to your projects!

December 9, 2024

Creating a NEON button with CSS

Creating a button is one thing! But creating a button that your visitors want to click is something else entirely. In any case, this neon button will catch the eye of everyone who visits your pages.

December 9, 2024

Creating an "Old School" button with CSS

Let's find out how to create an original button that's right up to date!

December 9, 2024

Make an animated notification message with JavaScript

Whether it's to quickly warn your users that a feature of your site is not yet available or to let them know that an action has been successfully completed, notifications are the simplest and most modern way to set up. Find out how in this article!

December 9, 2024

Create an animated "rainbow" button with CSS

In this article, we'll show you how to create a rainbow button that comes to life when the mouse hovers over it. A modern and sensational effect guaranteed!

December 9, 2024

Creating circled buttons on hover with HTML and CSS

For a menu or to encourage your readers to share your website, share buttons are essential elements to add to your website. Let's find out how to make them more modern with a "neon" effect that will surround the icon selected by your user.

December 9, 2024

Creating a sinking button with CSS

The buttons on a site are the main triggers for action: styling them and making them dynamic is very important in your development process! That's the aim of this article.

December 9, 2024

Become the solopreneur you dream of being.

First project, career change, business launch: access our courses, practice on real-world cases, and move forward with clear guidance.