您的位置:首页 > Web前端 > HTML

HTML 创建按钮实现跳转链接

2017-07-01 20:13 253 查看
How to create an HTML button that acts like a link?

1.使用 form

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


2.JavaScript

<button onclick="window.location.href='/page2'">Continue</button>


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


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

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


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 me</button>
</a>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  html