How to create html button with link ?

 In this tutorial, we are going to create a beautiful button with a link. To create a button with the link we use anchor tag <a>. By using cascade stylesheet (CSS) we can create a beautiful button with a link. 

1. First We need to create an HTML anchor tag with the class btn


<a  href="https://www.htmlspacecode.com" class="btn">Click Me</a>



By creating the above anchor tag the result looks like 

2. Now Styling the above tag which looks like a button

<style>
  .btn {
    font-family: sans-serif;
    background-color: #554caf;
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 5px;
  }
</style>



By applying the style anchor tag look like this


In this way, you can convert a link to a button by using the CSS style.



Reactions

Post a Comment

0 Comments