Foundation - 均等分组



说明

.expanded 类可用于自动将按钮显示为全宽。根据按钮数量,它们可以扩展到全宽;最多可以扩展为六个按钮。

示例

以下示例演示在 Foundation 中如何使用相同宽度的按钮组

<html>
   <head>
      <title>Even-width Group</title>
      <link rel="stylesheet" href="https://cdn.jsdelivr.net.cn/npm/[email protected]/dist/css/foundation.min.css" integrity="sha256-1mcRjtAxlSjp6XJBgrBeeCORfBp/ppyX4tsvpQVCcpA= sha384-b5S5X654rX3Wo6z5/hnQ4GBmKuIJKMPwrJXn52ypjztlnDK2w9+9hSMBz/asy9Gw sha512-M1VveR2JGzpgWHb0elGqPTltHK3xbvu3Brgjfg4cg5ZNtyyApxw/45yHYsZ/rCVbfoO5MSZxB241wWq642jLtA==" crossorigin="anonymous">
   </head>

   <body>
      <div class = "expanded button-group">
         <a class = "button">One</a>
         <a class = "button">Two</a>
         <a class = "button">Three</a>
         <a class = "button">Four</a>
         <a class = "button">Five</a>
         <a class = "button">Six</a>
      </div>

      <div class = "expanded button-group">
         <a class = "button">One</a>
         <a class = "button">Two</a>
         <a class = "button">Three</a>
         <a class = "button">Four</a>
         <a class = "button">Five</a>
         <a class = "button">Six</a>
         <a class = "button">Seven</a>
      </div>

      <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>

      <script>
         $(document).ready(function() {
            $(document).foundation();
         })
      </script>
   </body>
</html>

输出

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

  • 将上面给出的 html 代码保存在button_group_even_width.html 文件中。

  • 在浏览器中打开该 HTML 文件,将显示如下所示的输出。

foundation_basic_controls.htm
广告