HTML button with a link | simple example code

Use the HTML button with a link, you have to use <a> tag or add some JavaScript code. You can also sue CSS in case want HTML looks like a link as a button.

JavaScript

<a> tag

HTML button link code

Let’s create an HTML button that acts like a link. When you click the button, it redirects to a page.

Button as a Link using JavaScript

Output:

HTML button with link example

HTML button with link Using <a> tag

The <button> element allows children. The button by itself does nothing, but clicking it activates its parent link.

Using form and input type

The plain HTML way is to put it in a <form> wherein you specify the desired target URL in the action attribute

Q: How to make a button link to another page in HTML?

Answer:- Here is example code of button link to another page in HTML.

OR

If you are using bootstrap, you can use this to do it for you:

Do comment if you have any doubts and suggestions on this tutorial.

Note: The All HTML Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.