Quick Reach
The buttons of HTML are generally used to submit data to the web server, for navigation from one record to other etc. in the web pages. You can also make the buttons working as hyperlinks in your web pages. This tutorial explains how it can be done.
The way is quite simple; by placing the button code in place of anchor text the button can be used as HTML button link. There is another way to create buttons as links which is shown in the second example of this tutorial.
In the following example, we have created a link tag. The href attribute points to this website. In order to use the button as a link, we used the button tag in place of anchor text. See the example by clicking the link below:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
<!DOCTYPE html>
<html>
<head>
<title>HTML link / hyperlink demo</title>
</head>
<body>
<a href=“https://www.tutorialscollection.com/”>
<button>Tutorials Collection</button>
</a>
</body>
</html>
|
The other method to create a button link is by using the anchor tag inside the button element. In that case, you will start a button tag and rather than writing the text or caption for the button, use the anchor tag inside it, as shown in the example below.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
<!DOCTYPE html>
<html>
<head>
<title>HTML Button</title>
</head>
<body>
<button type=“button”><a href=“https://www.tutorialscollection.com/”>Tutorials Collection</a></button>
</body>
</html>
|
You can also apply the style to the button or <a> tag to make it look beautiful to create the button links.
Also see HTML Table | HTML tutorial
thx for help
Very useful your article, thank you very much.
Note: The first method does not work within a form, only outside. The second is useful in and out of a form, it is ideal.
Congratulations.