- Foundation - 基本資訊
- Foundation - 全域性樣式
- Foundation - Sass
- Foundation - JavaScript
- Foundation - JavaScript 工具
- Foundation - 媒體查詢
- Foundation - 網格
- Foundation - Flex 網格
- Foundation - 表格
- Foundation - 可見性類
- Foundation - 基本排版
- Foundation - 排版助手
- Foundation - 基本控制元件
- Foundation - 導航
- Foundation - 容器
- Foundation - 媒體
- Foundation - 外掛
- Foundation SASS
- Foundation - Sass 函式
- Foundation - Sass Mixin
- Foundation 庫
- Foundation - 運動使用者介面
- Foundation 實用資源
- Foundation - 快速指南
- Foundation - 實用資源
- Foundation - 討論
Foundation - 按鈕著色
說明
可以對按鈕進行著色,以使其具有附加含義。可以使用 .disabled 類停用按鈕,該類將按鈕顯示為淡化狀態,且不會停用控制元件。如果你要停用 <button> 元素,請向其新增 disabled 屬性。如果你要停用連結,請新增 aria-disabled 屬性。
示例
以下示例演示如何在 Foundation 中對按鈕著色。
<html>
<head>
<title>Button Coloring</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/foundation-sites@6.5.1/dist/css/foundation.min.css" crossorigin="anonymous">
</head>
<body>
<a class = "secondary button" href = "#">Secondary</a>
<button type = "button" class = "success button">Success</button>
<button type = "button" class = "alert button">Alert</button>
<a class = "warning button" href = "#">Warning</a>
<a class = "disabled button" href = "#">Disabled</a>
<button type = "button" class = "disabled button">Disabled</button>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/vendor/jquery.min.js"></script>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/foundation.min.js"></script>
<script>
$(document).ready(function() {
$(document).foundation();
})
</script>
</body>
</html>
輸出
執行以下步驟,瞭解上述程式碼的工作原理:
儲存以上給出的 html 程式碼 button_coloring.html 檔案。
在瀏覽器中開啟該 HTML 檔案,將顯示如下所示的輸出。
foundation_basic_controls.htm
廣告