
- 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-tooltip 將容器標識為 MDL 工具提示,並且在工具提示容器元素中必需。 |
2 | mdl-tooltip--large 設定大號字型效果,並且是可選的;在工具提示容器元素上使用。 |
示例
以下示例將幫助你理解如何使用 mdl-tooltip 類來顯示不同型別的工具提示。
mdl_tooltips.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"> <script langauage = "javascript"> function showMessage(value) { document.getElementById("message").innerHTML = value; } </script> </head> <body> <table> <tr><td>Simple Tooltip</td><td>Large Tooltip</td></tr> <tr> <td> <div id = "tooltip1" class = "icon material-icons">add</div> <div class = "mdl-tooltip" for = "tooltip1">Follow</div> </td> <td> <div id = "tooltip2" class = "icon material-icons">print</div> <div class = "mdl-tooltip mdl-tooltip--large" for = "tooltip2">Print</div> </td> </tr> <tr> <td>Rich Tooltip</td><td>Multiline Tooltip</td></tr> <tr> <td> <div id = "tooltip3" class = "icon material-icons">cloud_upload </div> <div class = "mdl-tooltip" for = "tooltip3">Upload <i>zip files</i></div> </td> <td> <div id = "tooltip4" class = "icon material-icons">share</div> <div class = "mdl-tooltip" for = "tooltip4"> Share your content<br>using social media</div> </td> </tr> </table> </body> </html>
結果
驗證結果。
廣告