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

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

    If you want to create a button that is used for a URL anywhere, create a button class for an anchor.

    a.button {
        background-color: #999999;
        color: #FFFFFF !important;
        cursor: pointer;
        display: inline-block;
        font-weight: bold;
        padding: 5px 8px;
        text-align: center;
        -webkit-border-radius: 5px;
        border-radius: 5px;
    }
    .button:hover {
        text-decoration: none;
    }
    

提交回复
热议问题