
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
How do I create an HTML button that acts like a link?
We can easily create an HTML button to act like a link and clickable. Let us see the following examples −
- Create an HTML button link with the <a> tag
- Create an HTML button link with the <form> tag
- Create an HTML button link with the onclick event
Create an HTML button link with the <a> tag
In this example, we will create a link button with <a> tag. The <button> tag is set inside the <a> tag for this −
<a href='https://www.tutorialspoint.com/tutorialslibrary.htm'> <button class="mybtn"> Tutorial Library </button> </a>
Do add the cursor to the pointer value to make the cursor look like a link is being clicked on the button itself. Here’s the button style −
.mybtn { background-color: white; text-align: center; display: inline-block; font-size: 15px; cursor: pointer; }
Example
Let us now see the complete example to create an HTML button link with the <a> tag −
<!DOCTYPE html> <html> <head> <title>Button Link</title> <style> .mybtn { background-color: white; text-align: center; display: inline-block; font-size: 15px; cursor: pointer; } </style> </head> <body> <h1>Free Resources</h1> <p>Refer the free tutorials:</p> <a href='https://www.tutorialspoint.com/tutorialslibrary.htm'> <button class="mybtn"> Tutorial Library </button> </a> </body>
Output

Click on the button link Tutorial Library. It will open the link added in the button −
Create an HTML button link with the form tag
In this example, we will create a link button with the <form> tag. The <button> tag is set inside the <form> tag for this −
<form action="https://www.tutorialspoint.com/latest/ebooks"> <button class = "mybtn" type="submit"> Ebooks </button> </form>
Do add the cursor to the pointer value to make the cursor look like a link is being clicked on the button itself. Here is the button style −
mybtn { background-color: white; text-align: center; display: inline-block; font-size: 15px; cursor: pointer; }
Example
Let us now see the complete example to create an HTML button link with the <form> tag −
<!DOCTYPE html> <html> <head> <title>Button Link</title> <style> .mybtn { background-color: white; text-align: center; display: inline-block; font-size: 15px; cursor: pointer; } </style> </head> <body> <h1>Resources</h1> <p>Refer the Ebooks:</p> <form action="https://www.tutorialspoint.com/latest/ebooks"> <button class = "mybtn" type="submit"> Ebooks </button> </form> </body>
Output

Click on the button link Ebooks. It will open the link added in the button −
Create an HTML button link with the onclick event
In this example, we will create a link button with the onclick event −
<button class="mybtn" onclick="window.location.href = 'https://www.tutorialspoint.com/codingground.htm';"> CodingGround </button>
Do add the cursor to the pointer value to make the cursor look like a link is being clicked on the button itself. Here is the button style −
mybtn { background-color: white; text-align: center; display: inline-block; font-size: 15px; cursor: pointer; }
Example
Let us now see the complete example to create an HTML button link with the onclick event −
<!DOCTYPE html> <html> <head> <title>Button Link</title> <style> .mybtn { background-color: white; text-align: center; display: inline-block; font-size: 15px; cursor: pointer; } </style> </head> <body> <h1>Online Compiler</h1> <p>Refer the complier to run programs online:</p> <button class="mybtn" onclick="window.location.href = 'https://www.tutorialspoint.com/codingground.htm';"> CodingGround </button> </body>
Output

Click on the button link CodingGround. It will open the link added in the button:

- Related Articles
- Create a button look like a link with Bootstrap
- How to create HTML link that doesnt follow the link?
- How do you make a button that adds text in HTML ?
- Create a link button with borders using CSS
- How to Create a Responsive Like Button in ReactJS?
- How to link a submit button to another webpage using HTML?
- How to create a bookmark link in HTML?
- How to create a download link with HTML?
- How to create Instagram Like button in ReactJS?
- JavaScript - Create an alert on clicking an HTML button
- How to create a link to send email in HTML?
- How do I specify an arrow-like linestyle in Matplotlib?
- How to create a file upload button with HTML?
- How do we add a push button to HTML?
- How do I programmatically create a DragEvent for Angular app and HTML?
