---
title: "How to create an HTML button that acts like a link?"  
description: "How to create an HTML button that acts like a link?"  
author: "Utpal Vishwas"  
published: 2023-08-29  
updated: 2023-09-04  
canonical: https://www.mindstick.com/forum/159720/how-to-create-an-html-button-that-acts-like-a-link  
category: "html"  
tags: ["html", "html element"]  
reading_time: 2 minutes  

---

# How to create an HTML button that acts like a link?

How to create an [HTML](https://www.mindstick.com/articles/1530/design-a-simple-stylish-calculator-using-html-css-and-javascript) [button](https://www.mindstick.com/articles/63/how-to-add-button-in-datagridview-in-csharp-dot-net) that acts like a [link](https://www.mindstick.com/articles/23633/link-builder)?

## Replies

### Reply by Aryan Kumar

To create an HTML button that acts like a link, you can use the `<a>` tag with the `href` attribute. The `href` attribute specifies the URL that the button will link to. For example, the following code will create a button that links to the Google homepage:

HTML

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

You can also use the `target` attribute to specify the target window or frame that the link will open in. The following code will open the link in a new tab:

HTML

```plaintext
<a href="https://www.google.com" target="_blank">Google</a>
```

To make the button look like a link, you can add the `button` element to the `a` tag. The `button` element has a number of style properties that you can use to customize the appearance of the button. For example, the following code will make the button blue and underlined:

HTML

```plaintext
<button type="button" class="btn btn-primary">Google</button>
```

The `type` attribute specifies the type of button. The value `button` is used for a regular button, and the value `submit` is used for a submit button. The `class` attribute specifies the CSS class that will be applied to the button.

Here are some additional tips for creating an HTML button that acts like a link:

- Use the `id` attribute to give the button a unique identifier. This will make it easier to style the button and to target it with JavaScript.
- Use the `disabled` attribute to disable the button. This will prevent the user from clicking the button.
- Use the `data-*` attributes to store custom data about the button. This data can be accessed by JavaScript.


---

Original Source: https://www.mindstick.com/forum/159720/how-to-create-an-html-button-that-acts-like-a-link

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
