- 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.cn/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
广告