How to make an HTML anchor tag (or link) look like a button with CSS?

Spread the love

Sometimes, we want to make an HTML anchor tag (or link) look like a button with CSS.

In this article, we’ll look at how to make an HTML anchor tag (or link) look like a button with CSS.

How to make an HTML anchor tag (or link) look like a button with CSS?

To make an HTML anchor tag (or link) look like a button with CSS, we add some styles.

For instance, we write

<a class="button">Add Problem</a>

to add a link.

Then we write

.button {
  display: block;
  width: 115px;
  height: 25px;
  background: #4e9caf;
  padding: 10px;
  text-align: center;
  border-radius: 5px;
  color: white;
  font-weight: bold;
  line-height: 25px;
}

to sety rthre bnackground set the background color of the link.

We set the color property to set the text color.

And we set the border-radius property to round the corners.

Conclusion

To make an HTML anchor tag (or link) look like a button with CSS, we add some styles.

Leave a Reply

Your email address will not be published. Required fields are marked *