
- Foundation 通用
- Foundation - 全域性樣式
- Foundation - Sass
- Foundation - JavaScript
- Foundation - JavaScript 實用工具
- Foundation - 媒體查詢
- Foundation - 網格
- Foundation - 靈活網格
- Foundation - 表單
- Foundation - 可見性類
- Foundation - 基本排版
- Foundation - 排版幫助器
- Foundation - 基本控制元件
- Foundation - 導航
- Foundation - 容器
- Foundation - 媒體
- Foundation - 外掛
- Foundation SASS
- Foundation - Sass 函式
- Foundation - Sass Mixins
- Foundation 庫
- Foundation - Motion UI
- Foundation 實用資源
- Foundation - 速查指南
- Foundation - 實用資源
- Foundation - 討論
Foundation - 根據螢幕尺寸隱藏
說明
它使用 .hide 類根據裝置隱藏元素。
你可以使用 hide 類隱藏小裝置的元素,而不是 .hide-for-small 類。
對於中等裝置,你可以使用 hide-for-medium 類隱藏內容,對於大型裝置,請使用 hide-for-large 類。
示例
以下示例演示了在 Foundation 中使用 .hide 類 -
<!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>Hide by Screen Size</title> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/foundation-sites@6.5.1/dist/css/foundation.min.css" crossorigin="anonymous"> <!-- Compressed JavaScript --> <script src="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/vendor/jquery.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/foundation-sites@6.5.1/dist/js/foundation.min.js" crossorigin="anonymous"></script> </head> <body> <h2>Hide by Screen Size Example</h2> <p class = "hide-for-small">This line disappears on small or medium screen.</p> <p class = "hide-for-medium">This line disappears on medium screen or larger.</p> <p class = "hide-for-large">This line disappears on large screen or larger.</p> </body> </html>
輸出
讓我們執行以下步驟,看看上面給出的程式碼如何工作 -
儲存以上給出的 HTML 程式碼為 hide_screen.html 檔案。
在瀏覽器中開啟此 HTML 檔案,顯示如下所示的輸出。
foundation_visibility_classes.htm
廣告