Believemy logo purple

Creating an "Old School" button with CSS

Let's find out how to create an original button that's right up to date!
Updated on December 9, 2024
Believemy logo

"Old School" but so trendy, let's discover how to create an original and clearly up-to-date button!

Image

 

Step 1

Let's start with the HTML code.

HTML
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css">
HTML
<div class="container">
  <a href="#">Read the article</a>
  <i class="fas fa-arrow-right"></i>
  <div class="bg"></div>
</div>

In this small project, we will use the font-awesome library. It allows us to easily add icons thanks to the fas fa-arrow-right class.

 

Step 2

Let's use the "Lobster" font from Google Fonts.

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

We will also use a quite "Old School" font from Google Fonts. This font will give a huge touch to our link.

 

Step 3

Let's style the .container class and its link.

CSS
.container {
  font-size: 2rem;
  color: white;
  position: absolute;
  cursor: pointer;
}

.container a {
  color: white;
  text-decoration: none;
  font-family: 'Lobster', cursive;
}

 

Step 4

Let's move on to the icon and the button's hover effect.

CSS
.container i {
  margin-left: 5px;
  font-size: 1.2rem;
  transition: all .5s;
}

.container a:hover ~ i {
  transform: translateX(5px);
}

 

Step 5

Let's handle the link's border.

CSS
.bg {
  position: absolute;
  bottom: 3px;
  left: -4px;
  border-radius: 10px;
  width: 25%;
  height: 25%;
  z-index: -1;
  background-image: linear-gradient(147deg, #FFE53B 0%, #FF2525 74%);
  transition: all .5s;
}

We give our list a simple look: it has no bullets and we ensure that each list item is wrapped in a full block with margins and a background.
The z-index: 5 will allow us in the next step to overlay the small border on the left side relative to the text, without it covering the entire item on hover (it is actually a pseudo-element ::before).

 

Step 6

Let's enlarge the border on hover.

CSS
.container a:hover ~ .bg {
  width: 85%;
}

When the user's mouse hovers over our link, we will enlarge the border width to 85%. This effect combined with our icon moving to the right allows us to finish the button.

Category: Development
Believemy logo
Comments (0)

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

Try for Free

Whether you're scaling your startup, building your first website, or transitioning to a developer role, Believemy is your new home. Join us, grow, and let’s build your project together.

Believemy is with anyone