在HTML中,可以使用<button>
标签来定义按钮,以下是一个简单的示例:
<!DOCTYPE html> <html> <head> <title>按钮示例</title> </head> <body> <h1>按钮定义示例</h1> <table border="1"> <tr> <th>小标题</th> <th>代码示例</th> </tr> <tr> <td>基本按钮</td> <td> <button type="button">点击我</button> </td> </tr> <tr> <td>带图标的按钮</td> <td> <button type="button"> <img src="icon.png" alt="图标"> 点击我 </button> </td> </tr> <tr> <td>带链接的按钮</td> <td> <a href="https://www.example.com"> <button type="button">点击我</button> </a> </td> </tr> </table> </body> </html>
在这个示例中,我们使用了<button>
标签来定义一个基本的按钮,我们还展示了如何将图标添加到按钮上,以及如何将按钮与链接关联。