目录

响应调整(Responsive Adjustments)

描述 (Description)

如果未给出flex网格中列的显式大小,则它将自动调整列的大小。 对于较小的屏幕,请使用.small-*类。 medium-expandlarge-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>

输出 (Output)

让我们执行以下步骤,看看上面给出的代码是如何工作的 -

  • 保存上面给出的HTML代码responsive_adjustment.html文件。

  • 在浏览器中打开此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>

输出 (Output)

让我们执行以下步骤,看看上面给出的代码是如何工作的 -

  • 保存上面给出的html代码automatic_stacking.html文件。

  • 在浏览器中打开此HTML文件,输出显示如下。

新页面打开
↑回到顶部↑
WIKI教程 @2018