Foundation - 不完全行



描述

當行中所含列不滿 12 時,Foundation 會自動將最後一個元素浮動到右方。你可以將.end 類包含在最後一個元素中,使元素浮動至左方。

示例

以下示例演示如何在 Foundation 中使用incomplete_rows

<!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>
      <h2>Incomplete rows example</h2>

      <div class = "row">
         <div class = "small-4 columns" style = "background-color:#808000;">
            small-4 columns
         </div>

         <div class = "small-4 columns" style = "background-color:#8BD6EE;">
            small-4 columns
         </div>
      </div>

      <div class = "row">
         <div class = "small-4 columns" style = "background-color:#8BD6EE;">
            small-4 columns
         </div>

         <div class = "small-4 columns end" style = "background-color:#808000;">
            small-4 columns end
         </div>
      </div>

   </body>
</html>

輸出

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

  • 儲存以上給定的 html 程式碼為 incomplete_rows.html 檔案。

  • 在瀏覽器中開啟此 HTML 檔案,會顯示如下所示的輸出。

foundation_the_grid.htm
廣告
© . All rights reserved.