响应调整(Responsive Adjustments)
优质
小牛编辑
129浏览
2023-12-01
描述 (Description)
如果未给出flex网格中列的显式大小,则它将自动调整列的大小。 对于较小的屏幕,请使用.small-*类。 medium-expand或large-expand类用于扩展行为。
例子 (Example)
以下示例演示了在Foundation中使用responsive adjustment -
<!DOCTYPE html>
<html>
<head>
<meta name = "viewport" content = "width = device-width, initial-scale = 1">
<title>Foundation Template</title>
<link rel = "stylesheet" href = "css/foundation.css" />
<script src = "js/vendor/jquery.min.js"></script>
<script src = "js/foundation.min.js"></script>
</head>
<body>
<h2>Example of Flex Grid</h2>
<div class = "row">
<div class = "small-6 large-expand columns" style = "background-color:#8BD6EE;">
First column
</div>
<div class = "small-6 large-expand columns" style = "background-color:#C0B0F0;">
Second column
</div>
<div class = "small-6 large-expand columns" style = "background-color:#8BD6EE;">
Third column
</div>
<div class = "small-6 large-expand columns" style = "background-color:#C0B0F0;">
Forth column
</div>
<div class = "small-6 large-expand columns" style = "background-color:#8BD6EE;">
Fifth column
</div>
<div class = "small-6 large-expand columns" style = "background-color:#C0B0F0;">
Sixth column
</div>
</div>
</body>
</html>
自动堆叠
自动堆叠是用于响应调整行为的简写类。 .[size]-unstack类用于默认堆叠行中的所有列,并在较大的屏幕中.[size]-unstack堆栈。
例子 (Example)
以下示例演示了在Foundation中使用automatic stacking -
<!DOCTYPE html>
<html>
<head>
<meta name = "viewport" content = "width = device-width, initial-scale = 1">
<title>Foundation Template</title>
<link rel = "stylesheet" href = "css/foundation.css" />
<script src = "js/vendor/jquery.min.js"></script>
<script src = "js/foundation.min.js"></script>
</head>
<body>
<h2>Example of Flex Grid</h2>
<div class = "row medium-unstack">
<div class = "columns" style = "background-color:#FF6347;">First</div>
<div class = "columns" style = "background-color:#7B68EE;">Second</div>
<div class = "columns" style = "background-color:#FF6347;">Third</div>
<div class = "columns" style = "background-color:#7B68EE;">Forth</div>
<div class = "columns" style = "background-color:#FF6347;">Fifth</div>
<div class = "columns" style = "background-color:#7B68EE;">Sixth</div>
</div>
</body>
</html>