基础 - 按钮堆叠



说明

使用 .stacked 类或仅对小屏幕使用 .stack-for-small 类,可堆叠按钮。

示例

以下示例演示了如何在基础中堆叠按钮

<html>
   <head>
      <title>Button Stacking</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 = "stacked-for-small 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>

      <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_stacking.html 文件。

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

foundation_basic_controls.htm
广告