我正在尝试添加指向我的按钮的链接。
我当前的 HTML 代码如下
<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>
如何为每个按钮添加指向其他页面的链接 例如...如果我点击:获取支持按钮,它会将我重定向到我已经创建的支持页面。
最佳答案
<a>
是用于创建链接的 HTML 元素,而不是 <button>
, 所以使用 <a>
带有 href
的元素属性而不是 <button>
.
然后您可以根据自己的喜好设置它的样式,使其看起来很像按钮(尽管我注意到您应用于 <button>
元素的大部分 CSS 旨在使其看起来不像一个按钮。您可能唯一需要做的就是 display: inline-block; text-decoration: none; color: black
)。
关于html - 添加链接到按钮 HTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25889686/