Create a share button pasted at the bottom of the page with CSS

Displaying a social networking sharing button on your site helps to increase the number of visits. Nowadays, it has become essential to offer this kind of button whenever we publish articles or project presentations. Let's find out how to set up this kind of button in this article!
•
Updated on August 14, 2026
•
3 min read
Believemy logo

Displaying a social media share button on your website helps increase the number of visits. Nowadays, it has become essential to offer this type of button when providing articles or project presentations. Let's discover together how to implement this type of button in this article!

Demo

 

Step 1

Let's include first Font Awesome 5.

HTML
<link rel=”stylesheet” href=”https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css”>

 

Step 2

Let's handle the HTML code.

HTML
<div class="share">
  <ol>
    <li><a href="#"><i class="fab fa-instagram fa-2x"></i></a></li>
    <li><a href="#"><i class="fab fa-facebook fa-2x"></i></a></li>
    <li><a href="#"><i class="fab fa-whatsapp fa-2x"></i></a></li>
    <li><a href="#"><i class="fab fa-twitter fa-2x"></i></a></li>
  </ol>
  <div class="toggle"></div>
</div>

Thanks to the Font Awesome library we added in the first step, each class starting with “fa” will be retrieved and transformed into an icon.

The class fa-2x allows doubling the size of the icon.

You can find all available icons on fontawesome.com/icons.

 

Step 3

Let's style the "share" button.

CSS
.toggle {
  width: 50px;
  height: 50px;
  background: #c70039;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
}

.toggle::before {
  content: '\f1e0';
  width: 100%;
  height: 100%;
  position: absolute;
  color: white;
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  text-align: center;
  line-height: 50px;
  font-size: 22px;
}

It is very important to add the font 'Font Awesome 5 Free' and specify that we want to use a bold font (font-weight) of 900.

 

Step 4

Let's now style the bullet list of our button.

CSS
.share.active .toggle::before {
  content: '\f00d';
  font-size: 2rem;
}
.share {
  position: fixed;
  bottom: 70px;
  right: 70px;
}
.share ol {
  position: absolute;
  width: 50px;
  height: 50px;
}

 

Step 5

Let's style each link.

CSS
.share ol li {
  position: absolute;
  width: 50px;
  height: 50px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all .3s;
  opacity: 0;
}

.share ol li a {
  color: black;
}

.share.active ol li {
  opacity: 1;
  transition: all .3s;
}

 

Step 6

Let's shift each item a certain distance to make them appear from each side of our button.

CSS
.share.active ol li:nth-child(1) {
  transition-delay: .1s;
  transform: translateX(60px);
}

.share.active ol li:nth-child(2) {
  transition-delay: .2s;
  transform: translateY(60px);
}

.share.active ol li:nth-child(3) {
  transition-delay: .3s;
  transform: translateX(-60px);
}

.share.active ol li:nth-child(4) {
  transition-delay: .4s;
  transform: translateY(-60px);
}

 

Step 7

Let's finish our share button by detecting the user's click to add or remove the active class.

JAVASCRIPT
const toggle = document.querySelector('.toggle');

toggle.addEventListener('click', () => {
  const shareBtn = document.querySelector('.share');
  shareBtn.classList.toggle('active');
});

When we click on the "share" button, we ask our browser to add the "active" class if it is present. Otherwise, we ask to remove it using toggle().

 

Want to Go Further

If you want to go further, for example, to position your button relative to other elements on your page, nothing is better than doing it with the incredible CSS Flexbox functionality.

Go take a look at our complete Flexbox guide to learn how to position your 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 a social network sharing button

For your blog posts or on the pages that present your projects from a portfolio, presenting a modern, non-intrusive button to allow your visitors to share your website or go to your social networks is ideal. Let's look at how to create this type of button together in this article.

December 9, 2024

Add a "click to copy" button with JavaScript

Would you like to make it quick and easy for your users to copy text onto your project? That famous link to share your article? That affiliate link that helps you generate extra sales? Then this article is for you! Let's take a look at the two main methods for adding a "click to copy" button with the help of JavaScript.

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 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

Create a heartbeat button

For a main button or even for a button you want to highlight, offering this heartbeat effect can give your website a very modern feel. Find out how in this article.

December 6, 2024

Create a very modern hover on a link

Here's an easy way to create a very modern hover on a link! There are lots of possible effects for buttons and links: the better they look, the more likely your users will be to click on them.

December 9, 2024

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.

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.