按屏幕大小显示(Show by Screen Size)
优质
小牛编辑
132浏览
2023-12-01
描述 (Description)
它通过在页面上使用.show类显示基于设备的元素,用户正在查看该元素。
您可以使用show-for-small类show-for-small小型设备的内容,对于中型设备,使用show-for-medium类,对于大型设备,可以使用show-for-large类。
例子 (Example)
以下示例演示了在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://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/css/foundation.css">
<script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/vendor/jquery.min.js"></script>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/foundation.min.js"></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>