将链接添加到按钮HTML [英] Add link to button HTML
问题描述
我正在尝试将链接添加到我的按钮.
I'm trying to add link to my buttons.
我当前的HTML代码在下面
My current HTML codes are below
<td>
<button style="background: url('images/button1.png') no-repeat; background-size:155px; left: 200px; width: 155px; height: 50px; border: 0;">Get Support</button>
<td>
<button style="background: url('images/button2.png') no-repeat; background-size:155px; left: 200px; width: 155px; height: 50px; border: 0;">Shop Bike</button>
</td>
<td>
<button style="background: url('images/button2.png') no-repeat; background-size:155px; left: 200px; width: 155px; height: 50px; border: 200px;">Button Three</button>
</td>
如何为每个按钮添加到其他页面的链接 例如...如果单击获取支持"按钮,它将把我重定向到我已经创建的支持页面.
How can I add link to other pages for each of those buttons for example... If I click on: Get support button, it will redirect me to the support page which I already created.
推荐答案
<a>
是用于创建链接的HTML元素,而不是<button>
,因此请使用具有href
属性的<a>
元素代替 .
<a>
is the HTML element used for creating links, not <button>
, so use an <a>
element with an href
attribute instead of a <button>
.
然后,您可以根据需要设置其样式,使其看起来像一个按钮(尽管我注意到,要应用于<button>
元素的大多数CSS都旨在使其看起来与众不同一个按钮.您可能唯一需要做的就是display: inline-block; text-decoration: none; color: black
).
You can then style it to look at much like a button as you like (although I note that most of the CSS you are applying to your <button>
elements is geared at making it look unlike a button. About the only thing you are likely to need to do to it is display: inline-block; text-decoration: none; color: black
).
这篇关于将链接添加到按钮HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!