User Tools

Site Tools


java:howtomakealinklooklikeabutton

How to make a link look like a button

From time, appears the need of making a link to look like a button. If you search through internet you will see lots of solutions, however, it is surprising that nobody have came across this solution. If you have a link:

  <a href="http://www.example.com">Please click here</a>

The corresponding button that does exactly the same behaviour is this:

  <form method="GET" action="http://www.example.com">
  <input type="submit" name="Please click here">
  </form>

This solution has the advantage that every style you will apply to buttons in general will affect to this (because is a fucking real button, not an styled one). The “GET” method means exactly this: make a link with the values of the parameters and navigate through it. So, putting zero parameters make the result equivalent to click on a link.

java/howtomakealinklooklikeabutton.txt · Last modified: 2022/12/02 22:02 by 127.0.0.1