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!
•
Updated on August 14, 2026
•
2 min read
Believemy logo

Let's discover together in this article how to create a three-dimensional button that will add a touch of softness and perspective to your projects!

Image

 

Step 1

The HTML code.

HTML
<button class="btn">Create an Account</button>

Why make it complicated? Coding is fun!

 

Step 2

Let's style the button to start.

CSS
.btn {
  width: 195px;
  height: 40px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: arial;
  cursor: pointer;
  outline: none;
  border: none;
  transform: rotate(-30deg) skewX(25deg) translate(0, 0);
  box-shadow: -10px 10px 10px rgba(0, 0, 0, 0.5);
  background: #e76f6f;
  color: white;
  transition: all .5s;
  position: relative;
}

In this step, we use very different CSS functions from what you might be used to: rotate, skewX, and translate.

  • Rotate() allows us to rotate the button.
  • SkewX() allows us to "compress" the button to achieve this three-dimensional button effect.
  • Translate() allows us to move and shift our button. For now, we initialize it to its original position, but we will modify it on hover.

 

Step 3

Now let's style the before pseudo-element.

CSS
.btn::before {
  content: '';
  position: absolute;
  top: 5px;
  left: -10px;
  width: 10px;
  height: 100%;
  background: #795a5a;
  transform: skewY(-45deg);
}

Here, we create the first side of our button, which will give us this true three-dimensional button effect.

We are using the skewY function instead of skewX here.

 

Step 4

Let's do the same with after.

CSS
.btn::after {
  content: '';
  position: absolute;
  top: 40px;
  left: -5px;
  width: 195px;
  height: 10px;
  background: #795a5a;
  transform: skewX(-45deg);
}

Attention: we use skewX and not skewY here.

 

Step 5

Finally, we need to lift our button on hover.

CSS
.btn:hover {
  transform: rotate(-30deg) skewX(25deg) translate(20px, -20px);
  box-shadow: -30px 30px 10px rgba(0, 0, 0, 0.5);
}

When hovering over the button, we use the translate function to lift our button 20px upwards. We specify -20px to prevent the button from shifting to the right.

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

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

Creating a cascading animation on text

For a slogan or for an animation on a very important page of your project, this very modern effect is also very easy to achieve. Let's take a look at how to do it in this article.

December 9, 2024

Creating an animated list with CSS

Let's find out how to create an animated hover list!

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

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

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.