- Material Design Lite 教程
- MDL - 主页
- MDL - 概览
- MDL - 设置环境
- MDL - 布局
- MDL - 网格
- MDL - 选项卡
- MDL - 页脚
- MDL - 徽章
- MDL - 按钮
- MDL - 卡片
- MDL - 进度条
- MDL - 微调框
- MDL - 菜单
- MDL - 滑块
- MDL - 勾选框
- MDL - 单选按钮
- MDL - 图标
- MDL - 开关
- MDL - 数据表
- MDL - 文本框
- MDL - 工具提示
- Material Design Lite 资源
- MDL - 快速指南
- MDL - 有用资源
- MDL - 讨论
Material Design Lite - 图标
MDL 提供多种 CSS 课程来应用各种预定义的可视化和行为增强,并显示不同类型的勾选框作为图标。以下表格列出了可用课程及其效果。
| 序号 | 课程名称和说明 |
|---|---|
| 1 | mdl-icon-toggle 标识标签为 MDL 组件,标签元素需要使用该组件。 |
| 2 | mdl-js-icon-toggle 设置标签的基本 MDL 行为,标签元素需要使用该组件。 |
| 3 | mdl-icon-toggle__input 设置基本 MDL 行为以进行图标切换,输入元素(图标切换)需要使用该组件。 |
| 4 | mdl-icon-toggle__label 设置基本 MDL 行为以添加标题,i 元素(图标)需要使用该组件。 |
| 5 | mdl-js-ripple-effect 设置波动点击效果,可选;在标签元素上添加,不在输入元素(图标切换)上添加。 |
示例
以下示例展示了使用 mdl-icon-toggle 课程以将不同类型的勾选框显示为图标。
mdl_icons.htm
<html>
<head>
<script
src = "https://storage.googleapis.com/code.getmdl.io/1.0.6/material.min.js">
</script>
<link rel = "stylesheet"
href = "https://storage.googleapis.com/code.getmdl.io/1.0.6/material.indigo-pink.min.css">
<link rel = "stylesheet"
href = "https://fonts.googleapis.ac.cn/icon?family=Material+Icons">
</head>
<body>
<table>
<tr><td>On Icon</td><td>Off Icon</td>
<td>Disabled Icon</td></tr>
<tr>
<td>
<label class = "mdl-icon-toggle mdl-js-icon-toggle mdl-js-ripple-effect"
for = "icon-toggle-1">
<input type = "checkbox" id = "icon-toggle-1"
class = "mdl-icon-toggle__input" checked>
<i class = "mdl-icon-toggle__label material-icons">format_bold</i>
</label>
</td>
<td>
<label class = "mdl-icon-toggle mdl-js-icon-toggle mdl-js-ripple-effect"
for = "icon-toggle-2">
<input type = "checkbox" id = "icon-toggle-2"
class = "mdl-icon-toggle__input">
<i class = "mdl-icon-toggle__label material-icons">format_italic</i>
</label>
</td>
<td>
<label class = "mdl-icon-toggle mdl-js-icon-toggle mdl-js-ripple-effect"
for = "icon-toggle-2">
<input type = "checkbox" id = "icon-toggle-2"
class = "mdl-icon-toggle__input" disabled>
<i class = "mdl-icon-toggle__label material-icons">format_underline</i>
</label>
</td>
</tr>
</table>
</body>
</html>
结果
验证结果。
广告