内联标签和按钮(Inline Labels and Buttons)

优质
小牛编辑
128浏览
2023-12-01

描述 (Description)

额外的文本或控件可以附加到输入字段的左/右。 将元素包含在容器.input-group ,然后将以下类添加到里面的元素中 -

  • input-group-field - 在文本字段上添加。

  • input-group-label - 添加文本标签。

  • input-group-button - 添加按钮。

例子 (Example)

以下示例演示了在Foundation中使用label positioning

<html>
   <head>
      <title>Form Inline Labels and Buttons</title>
      <link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/css/foundation.css">
   </head>
   <body>
      <form>
         <div class = "input-group">
            <span class = "input-group-label">$</span>
            <input class = "input-group-field" type = "number">
            <a class = "input-group-button button">Submit</a>
         </div>
      </form>
      <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>