HTML 创建按钮实现跳转链接

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

1.使用 form

method="get" action="/page2"> <button type="submit">Continuebutton> form>

2.JavaScript

<button onclick="window.location.href='/page2'">Continuebutton>
<button onclick="location.href='http://www.example.com'" type="button"> www.example.com button>

3.使用链接,样式设置成按钮

<a href="http://google.com" class="button">Continuea>

css:

a.button {
    -webkit-appearance: button;
    -moz-appearance: button;
    appearance: button;

    text-decoration: none;
    color: initial;
}

4.链接+button

<a href="http://www.stackoverflow.com/">
    <button>Click mebutton>
a>

你可能感兴趣的:(html,前端)