按屏幕大小隐藏(Hide by Screen Size)
优质
小牛编辑
130浏览
2023-12-01
描述 (Description)
它使用.hide类隐藏基于设备的元素。
您可以使用hide类而不是使用.hide-for-small类来隐藏小型设备的元素。
对于中型设备,您可以使用hide-for-medium类隐藏内容,对于大型设备,可以使用hide-for-large类。
例子 (Example)
以下示例演示了在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://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>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>