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

后端 未结 30 3592
长发绾君心
长发绾君心 2020-11-21 04:18

I would like to create an HTML button that acts like a link. So, when you click the button, it redirects to a page. I would like it to be as accessible as possible.

30条回答
  •  一向
    一向 (楼主)
    2020-11-21 05:06

    It is actualy very simple and without using any form elements. You can just use the tag with a button inside :).

    Like this:

    
    

    And it will load the href into the same page. Want a new page? Just use target="_blank".

    EDIT

    Couple of years later, while my solution still works, keep in mind you can use a lot of CSS to make it look whatever you want. This was just a fast way.

提交回复
热议问题