目录

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

描述 (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>

输出 (Output)

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

  • 保存上面给出的html代码form_inline_labels_buttons.html文件。

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

新页面打开
↑回到顶部↑
WIKI教程 @2018