---
title: "How to create a href link that will act like a button?"  
description: "How to create a href link that will act like a button?"  
author: "Utpal Vishwas"  
published: 2023-08-29  
updated: 2023-09-02  
canonical: https://www.mindstick.com/forum/159723/how-to-create-a-href-link-that-will-act-like-a-button  
category: "html"  
tags: ["html input", "html element"]  
reading_time: 2 minutes  

---

# How to create a href link that will act like a button?

How to create a [href link](https://www.mindstick.com/blog/305892/what-is-an-href-link-5-best-practices-you-must-know) that will act like a [button](https://www.mindstick.com/articles/63/how-to-add-button-in-datagridview-in-csharp-dot-net)?

## Replies

### Reply by Aryan Kumar

To create a `<a>` tag that will behave like a button, you can set its `type` attribute to `button`. This will tell the browser to render the [link](https://www.mindstick.com/articles/23633/link-builder) as a button, rather than as a regular hyperlink.

For example, the following code will create a link that will behave like a button:

HTML

```plaintext
<a href="https://www.google.com" type="button">Go to Google</a>
```

You can also style the button using CSS. For example, the following CSS code will style the button to have a blue background and white text:

CSS

```plaintext
a.button {
  background-color: blue;
  color: white;
  padding: 10px 20px;
  border-radius: 5px;
}
```

In this code, the `a.button` selector is used to select all links with the `type` attribute set to `button`. The `background-color` property is set to blue, the `color` property is set to white, the `padding` property is set to 10px 20px, and the `border-radius` property is set to 5px.

Here are some additional things to keep in mind when creating a `<a>` tag that will behave like a button:

- The `href` attribute is still required, even though the link will not actually navigate to the specified URL.
- The `target` attribute can be used to specify the target window or frame for the link.
- The `onclick` attribute can be used to specify an event handler that will be triggered when the button is clicked.


---

Original Source: https://www.mindstick.com/forum/159723/how-to-create-a-href-link-that-will-act-like-a-button

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
