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.
•
Updated on August 14, 2026
•
4 min read
Believemy logo
In this article

Buttons on a website are the main action triggers: styling and dynamizing them is very important in your development processes! This is the goal of this article.

You can find the entire tutorial on our Instagram account

 

Step 1

Firstly, we need to specify where to place our button. We have two possible choices:

  1. Create a button that redirects a user (using a link)
  2. Create a button that performs an action (using JavaScript, for example)

We will agree that a button either performs a redirection or an action.

Depending on the type of effect you want to achieve with your button, you will need to choose between three possibilities:

  1. Create a link and style it as if it were a button (using the <a></a> tag);
  2. Create a button with the <button></button> tag;
  3. Create a button with the <input type="button" /> tag (for use in a form).

Before creating a button, it is essential to understand the context in which you will use it. For example, we will not use a button with the <input type="button" /> tag if it is intended to redirect a user. Instead, we will prefer this tag within a form.

To create a button, the first thing we need to do is create a class. This is simply a way for us to make our lives easier by factoring out our code. Indeed, when we want to change the style of our button: a simple change in the class will suffice.

Let’s start by creating a button that redirects a user. To do this, here’s how to create a button with HTML:

HTML
<a href="#" class="action-button">
    Click me
</a>

Note that it is also possible to use the dedicated HTML button tag with button:

HTML
<a href="#">
    <button class="action-button">
        Click me
    </button>
</a>

Both are exactly identical. The only difference is that with the button tag, we will receive a default style generated by the browser:

different default styles of a button across browsers

 

Step 2

For this button, let’s use an original font! I suggest using the Pacifico font from the excellent Google Fonts service.

If you don’t know how to use Google Fonts, you can learn to master it perfectly through this video dedicated specifically to it, created by our team.

CSS
@import url('https://fonts.googleapis.com/css2?family=Pacifico&display=swap');

We will place this @import code in our stylesheet.

As a reminder, @import allows you to integrate the content of one stylesheet into another stylesheet.

 

Step 3

Now that our customized font is in place, we can move on to creating our .action-button class.

To start, let’s create our selector:

CSS
.action-button {

}

Let’s begin by adding internal margin (padding), our customized font, and rounded borders:

CSS
.action-button {
    padding: 10px 40px;
    border-radius: 10px;
    font-family: 'Pacifico', cursive;
}

Let’s add the text-decoration: none property to remove the underline on our button (since in our small example it's a link):

CSS
.action-button {
    padding: 10px 40px;
    border-radius: 10px;
    font-family: 'Pacifico', cursive;
    /* Adding this new property */
    text-decoration: none;
}

Finally, let's style our button now. The secret lies in the bottom border of the button, which will allow us to play with effects.

CSS
.action-button {
    padding: 10px 40px;
    border-radius: 10px;
    font-family: 'Pacifico', cursive;
    text-decoration: none;
    /* Here we modify the color and background of our small button */
    background-color: #3498DB;
    border-bottom: 5px solid #2980B9;
    text-shadow: 0px -2px #2980B9;
    transition: all 0.1s;
    -webkit-transition: all 0.1s;
}

We will also style our button when it is clicked, using the very famous CSS active event selector:

CSS
.action-button:active {
    transform: translate(0px,5px);
    -webkit-transform: translate(0px,5px);
    border-bottom: 1px solid;
}

The transform property allows us to transform our button, rotate it, and many other things.

Here, we tell it not to move along the x-axis (horizontal) and to move 5px downward along the y-axis (vertical).

And that’s it! If you want to go even further, it is even possible to create a "neon" style button with CSS or even play with gradients to make rainbow buttons!

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

Creating a button with a "fill" effect using CSS

In this article, we'll be taking a look at the secret to achieving this "filling" effect on a button!

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

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

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

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

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.