如何創建:藥丸形按鈕

學習如何使用 CSS 創建藥丸形按鈕。

如何創建藥丸形按鈕

第一步 - 添加 HTML:

<button class="button">Pill Button</button>

第二步 - 添加 CSS:

使用 border-radius 屬性為按鈕添加圓角:

.button {
  background-color: #ddd;
  border: none;
  color: black;
  padding: 10px 20px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  margin: 4px 2px;
  cursor: pointer;
  border-radius: 16px;
}

親自試一試

相關頁面

教程:CSS 按鈕