Button as a link in HTML

Button as a link

Well, we can use the buttons as the links to another web page. This becomes possible when we write a button inside the tag. Remember when we discussed a tag, we had seen that the content between the starting tag and ending tag will represent something, clicking on which, we can move to some different web page.

Here is the code for using the buttons as links →

<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<meta http-equiv=”X-UA-Compatible” content=”IE=edge”>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<title>Understanding links</title>
</head>
<body>
<h1>Find the button below</h1>
<a href=”https://www.gyanipandit.com/”><button type=”button”>Click me!</button></a>
</body>
</html>

Now, when we click on the button, we go to GyaniPandit.
You might have seen that sometimes, there are some images, clicking on which, we are redirected somewhere else. This is done by getting images as links. This is also pretty easy. So, let’s have a look at how are we going to do this.