[HTML] — 按鈕 Button

Danny Hu
Jan 28, 2024

--

[HTML] — 按鈕 Button

按鈕

使用 <button> 可以製作一個按鈕。

<button>按鈕</button>

設定圓角

可以使用 css 的 border-radius 來調整按鈕的外型。

<button style="border-radius: 60px;">圓角按鈕</button>

增加連結

使用 <a> 包覆 <button> 可以使按鈕有超連結的功能。

這裡 <a> 有使用 「target=“_blank”」可以使點擊時,彈出新的視窗。

<a href="<https://www.google.com/>" target="_blank">
<button style="border-radius: 60px;">To Google</button>
</a>

完整程式碼

<button>按鈕</button>
<br><br><br>
<button style="border-radius: 60px;">圓角按鈕</button>
<br><br><br>
<a href="<https://www.google.com/>" target="_blank">
<button style="border-radius: 60px;">To Google</button>
</a>

參考資料

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button

--

--

Danny Hu

天賦探索 x 能量做事 x 生活美好 :生命美好可以創造,思想語言成就你世界