Make an arrow that expands when hovered over with CSS

Whether it's to make your users want to see your project, read your article or access a page on your website, presenting your link with an arrow will make it easier to catch your visitors' eye! Let's find out in this article how to animate this arrow to enhance your readers' experience.
•
Updated on August 14, 2026
•
2 min read
Believemy logo

Whether you want to entice your users to view your project, read your article, or access a page on your website, presenting your link with an arrow will make it easier to catch your visitors' eyes! Let's discover in this article how to animate this arrow to enhance your readers' experience.

Image

 

Step 1

Let's start, as usual, with the HTML code.

HTML
<a href="https://believemy.com" class="btn">
      <div class="arrow"></div>
      View the website
    </a>

We simply create a link with a class btn.
We then add a div with a class arrow and the text of our link.

 

Step 2

Let's style the link.

CSS
.btn {
      text-decoration: none;
      font-size: 1.4rem;
      color: #ff4754;
      display: flex;
      align-items: center;
    }

We use flexbox (display: flex) to align the arrow and the link text side by side.

 

Step 3

Now let's take care of the arrow's line.

CSS
.btn .arrow {
      margin-right: 1em;
      height: 0.1em;
      width: 1.5em;
      position: relative;
      background: #ff4754;
      transition: all 0.2s;
    }

Here, we simply create the line of our arrow. The end of the arrow will be created using the pseudo-elements ::before and ::after.

 

Step 4

Let's style the end of our arrow.

CSS
.btn .arrow::before,
    .btn .arrow::after {
      content: "";
      position: absolute;
      right: 0;
      top: 0;
      background: #ff4754;
      height: 0.1em;
      width: 0.6em;
    }

We create two elements that will be positioned at the top right of the line we created in the previous step.

 

Step 5

Let's enlarge the arrow on hover and finish our arrow.

CSS
.btn:hover .arrow {
      width: 5em;
    }

Our code is so functional and we have thought it out so well that we just need to set the arrow's line width to 5em so that it automatically enlarges on hover of the link. Congratulations to us!

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 map displaying links on mouse-over with CSS

To present your team or simply yourself, this animation will allow you to display the links to your social networks when you hover over the map: a striking effect guaranteed! Let's find out how to do it together.

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 an animated list with CSS

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

December 9, 2024

Create a glitch effect on mouse-over with CSS

Add a modern glitch effect to your presentations or your logo, whether it's hovering or permanent! Let's find out how.

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 hover text on image with CSS

We've already seen how to create an element that is displayed when the mouse hovers over an image, but in this article we'll show you how to display a whole host of information very fluidly by hovering the mouse over an element!

December 9, 2024

Creating animated presentation cards with JavaScript

Whether you're presenting the team behind your project or anything else, using animated presentation cards will give your page a successful finishing touch. Find out how in this article!

December 9, 2024

Create an animated gradient background on hover avec CSS

Whether it's to highlight a part of your website or a quote as in this example, generating and adding a gradient to the background can give your website a very modern touch. Find out in this article how to do it easily!

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.