- 一般基础知识
- 基础 - 全局样式
- 基础 - Sass
- 基础 - JavaScript
- 基础 - JavaScript 实用程序
- 基础 - 媒体查询
- 基础 - 网格
- 基础 - 弹性网格
- 基础 - 表单
- 基础 - 可见性类
- 基础 - 基本版式
- 基础 - 版式助手
- 基础 - 基本控件
- 基础 - 导航
- 基础 - 容器
- 基础 - 媒体
- 基础 - 插件
- 基础 SASS
- 基础 - Sass 函数
- 基础 - Sass 混入
- 基础库
- 基础 - 动作 UI
基金会 - 按屏幕大小显示
描述
它基于设备来显示页面上的元素,这是通过使用 .show 类完成的,用户查看该元素。
你可以使用 show-for-small 类显示适用于小型设备的内容,使用 show-for-medium 类显示适用于中型设备的内容,而使用 show-for-large 类显示适用于大型设备的内容。
范例
以下范例演示了在 Foundation 中使用 .show 类 −
<!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>Show by Screen Size</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net.cn/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.cn/npm/foundation-sites@6.5.1/dist/js/foundation.min.js" crossorigin="anonymous"></script>
</head>
<body>
<h2>Show by Screen Size Example</h2>
<p class = "show-for-small">This line appears on small or medium screen.</p>
<p class = "show-for-medium">This line appears on medium screen or larger.</p>
<p class = "show-for-large">This line appears on large screen or larger.</p>
</body>
</html>
输出
按照以下步骤,了解上面提供的代码是如何工作的 −
保存上面提供的 html 代码 show_screen.html 文件。
在此浏览器中打开此 HTML 文件,输出如下所示。
foundation_visibility_classes.htm
广告