
- 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.com/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>
結果
驗證結果。
廣告