Foundation - 可关闭的标注
说明
可通过对元素使用 data-closable 属性来关闭标注,从而创建可关闭的警告框。
示例
以下示例演示了 Foundation 中 可关闭的标注 的使用 −
<!doctype html> <head> <meta charset = "utf-8" /> <meta http-equiv = "x-ua-compatible" content = "ie = edge" /> <meta name = "viewport" content = "width = device-width, initial-scale = 1.0" /> <title>Closable Callout</title> <link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.5/css/foundation.css"> <link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/motion-ui/1.1.1/motion-ui.css"/> <script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.5/js/vendor/jquery.min.js"></script> <script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.5/js/foundation.min.js"></script> </head> <body> <h2>Closable Callout Example</h2> <div class = "alert callout" data-closable> <h5>This is Closable Callout</h5> <p>Foundation is a responsive front-end framework.</p> <button class = "close-button" data-close aria-label = "Dismiss alert">×</button> </div> </body> </html>
输出
让我们执行以下步骤来查看上述代码的工作原理 −
保存上述 html 代码 making_closable.html 文件。
在浏览器中打开此 HTML 文件,将显示如下所示的输出。