Table Maker3schools TranslateImage CompressorFavicon Icon GeneratorCrop & Resize Image
Apu
Apu November 24, 2022 › #HowTo #Html

How to create an HTML button that acts like a link

In this article we will explain some methods. You can use these to create a button that reacts like a link.

[1] Adding button element inside anchor element. #

Simply use the button element inside an anchor element.

<a href="https://example.com">
  <button>Click Me</button>
</a>

[2] Style the anchor element as a button. #

The anchor (<a>) element is used to create a hyperlink. So, we will style the anchor element as a button.

<a href="https://example.com">
  Click Me
</a>
<style>
  a{
    padding: 5px 10px;
    text-decoration: none;
    color:inherit;
    border-radius:5px;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
  }
</style>

In the above example, we used the CSS to make it look like a button. For example, we have added a background color, padding etc.

save
listen
AI Answer
Write Your Answer
loading
back
View All