Foundation - 巢狀



說明

我們可以把網格列巢狀到列中。在一列中,我們可以在其中定義更多列。

示例

以下示例演示了在 Foundation 中使用巢狀的方式 −

<!DOCTYPE html>
<html>
   <head>
      <title>Foundation Template</title>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">

      <link rel="stylesheet" href="https://cdn.jsdelivr.net/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/npm/foundation-sites@6.5.1/dist/js/foundation.min.js" crossorigin="anonymous"></script>
   </head>

   <body>
      <div class = "row">
         <h2>Grid - Nested Columns</h2>
         <div class = "small-9 columns"  style = "background-color:#8BD6EE;">
            <h4>Main column small-9</h4>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>

            <div class = "row">
               <div class = "small-6 columns"  style = "background-color:#808000;">
                  Nested inside the small-9 class
               </div>

               <div class = "small-6 columns"  style = "background-color:#FF6347;">
                  Nested inside the small-9 class
               </div>
            </div>

         </div>

         <div class = "small-3 columns" style = "background-color:#808000;">Column small-3 class
            <div class = "row">
               <div class = "small-8 columns" style = "background-color:#7B68EE;">
                  Nested inside small-3 class
               </div>
            </div>
         </div>

      </div>
   </body>
</html>

輸出

讓我們執行以下步驟,瞭解上述程式碼如何工作 −

  • 儲存上述 HTML 程式碼為 nested.html 檔案。

  • 在瀏覽器中開啟這個 HTML 檔案,結果如下所示。

foundation_the_grid.htm
廣告
© . All rights reserved.