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

后端 未结 30 3582
长发绾君心
长发绾君心 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:04

    I used this for a website I'm currently working on and it works great!. If you want some cool styling too I'll put the CSS down here.

    input[type="submit"] {
      background-color: white;
      width: 200px;
      border: 3px solid #c9c9c9;
      font-size: 24pt;
      margin: 5px;
      color: #969696;
    }
    
    input[type="submit"]:hover {
      color: white;
      background-color: #969696;
      transition: color 0.2s 0.05s ease;
      transition: background-color 0.2s 0.05s ease;
      cursor: pointer;
    }

    Working JSFiddle here.

提交回复
热议问题