HTML button like a link

How to create an HTML button that acts like a link?

Posted by tfran on 2016-07-08 09:03:54

HTML

The plain HTML way is to put it in a

 wherein you specify the desired target URL in the action attribute.

 


    

If necessary, set CSS display: inline; on the form to keep it in the flow with the surrounding text.

CSS

If CSS is allowed, simply use an  which you style to look like a button using among others the appearance property (only Internet Explorer support is currently (July 2015) still poor).

Go to Google
a.button {
    -webkit-appearance: button;
    -moz-appearance: button;
    appearance: button;

    text-decoration: none;
    color: initial;
}

Or pick one of those many CSS libraries like Bootstrap.

JavaScript

If JavaScript is allowed, set the window.location.href.

 


 
If JavaScript is allowed,