目录

操作方法 - 加载按钮


了解如何使用 CSS 创建加载按钮。




如何设置加载按钮的样式

步骤1)添加HTML:

添加图标库,例如 Font Awesome,并将图标附加到 HTML 按钮:

示例

<!-- Add icon library -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

<!-- Add font awesome icons to buttons (note that the fa-spin class rotates the icon) -->
<button class="buttonload">
  <i class="fa fa-spinner fa-spin"></i>Loading
</button>

<button class="buttonload">
  <i class="fa fa-circle-o-notch fa-spin"></i>Loading
</button>

<button class="buttonload">
  <i class="fa fa-refresh fa-spin"></i>Loading
</button>

步骤2)添加CSS:

示例

/* Style buttons */
.buttonload {
  background-color: #04AA6D; /* Green background */
  border: none; /* Remove borders */
  color: white; /* White text */
  padding: 12px 16px; /* Some padding */
  font-size: 16px /* Set a font size */
}
亲自试一试 »

提示:去我们的图标教程了解有关图标的更多信息。

提示:去我们的如何 - CSS 加载器了解如何使用 CSS 创建加载程序(没有图标库)。

去我们的CSS 按钮教程了解有关如何设置按钮样式的更多信息。