How do you create a button that is a link? | SoloLearn: Learn to code for FREE!


How do you create a button that is a link?

I looked, but didn't see any answers. How do you create a button that serves the purpose of the <a> tag, but is a button.

1/29/2020 10:31:19 PM


22 Answers

New Answer


You put the <a> tag inside of the button tag. You could also if you want different text size, put a tag such as <h3> inside of the <a> tag also. The example code: <button><a href="#LinkGoesHere"></a></button>


Put the <a> tag inside of the button tag.


To add onto Green Ghost, there is two types of links. One that heads to somewhere else in the code, or one that heads to another link/source. On top, you can have different colors using CSS. If you want it to be centered, add <center> tags like this: <center><button><a></a></button></center>


By using HTML... Real Answer: You can put tags inside of tags in HTML, so you would put the <a> tag inside of the <button> tag.


<button onclick="window.location.href = '';">Click Here</button> This is another way.


Here is another way: <form action=""> <input type="submit" value="Go to Google" /> </form>


Rei , what is the file? Is it a picture, or a link?


<html> <body> <button> <a href="></a>Assumed link for the explanation </button> </body> </html> i hope this answers your question


You can create button using <a> tag and CSS. And this will look more beautiful


<a href="url"> <input type="button" value="hyperlink button"> </a>


You can use <a> tag inside button tag or u can use <form action=‘file u want’> <button type=‘submit’></button>


its like ‘index.html’ or any other file name in the same dir


Ok. Thanks for the clarification.


<!DOCTYPE html> <html> <body> <button> <a href="paste link here"></a></button> </body> </html>


<a> tag inside the button tag is not good way. <a><button>Click</button></a>


<button><a href="link"></a></button> con una imagen sería: <a href="link"><img></a>


Anchor tag is not the only way. You can use Canvas, CSS, or JS to create one also.


<button> <a href="enter ur link"></a></button>


<a href=""></a>