Making a <button> that's a link in HTML

Viewed 203672

Basically, I like the way that <input type="submit"> is styled, with the clickable button when you add a little CSS. However, regular buttons are not styled as such, they have no such clickability without some major CSS or JS, and you have to use images.

I made submit buttons into links, by using the form action, but this requires me to make a new form for each button. How can I find a happy medium? Using multiple forms is causing problems in my styling that I can't seem to fix unless I find another way to make buttons that are links in HTML, that have a default style that makes them have a pressed state (and I don't mean browser default settings).

Any ideas?

7 Answers

Use javascript:

<button onclick="window.location.href='/css_page.html'">CSS page</button>

You can always style the button in css anyaways. Hope it helped!

Good luck!

<a id="reset-authenticator" asp-page="./ResetAuthenticator"><input type="button" class="btn btn-primary" value="Reset app" /></a>

Related