【问题标题】:I want to print some tag just after bootstrap input fields tag at the same line我想在同一行的引导输入字段标签之后打印一些标签
【发布时间】:2019-10-14 19:47:24
【问题描述】:

I want something just like this. But if it is showing below the input fields。我下面的代码显示输入字段,但我希望它们都在同一行。我们该怎么做?

<div class="form-group">
  <label for="price">Price</label>
  <input type="number" class="form-control" name="price" placeholder="Price">
  <a class="btn">X</a>
</div>

【问题讨论】:

  • 在 HTML 示例中您只有一个 input。假设您实际上有多个实例,然后删除块级 div 元素包装器,或在 CSS 中将其设置为 display: inline-block;,或使用 span 或其他一些内联元素。 label 也是如此,因为这也是块级
  • X 不在输入字段下方显示的同一行,但我也使用 span
  • 请向我们展示您尝试过的内容以及所有相关的 CSS

标签: jquery html bootstrap-4


【解决方案1】:

如果您希望.form-group 中的所有子项都显示为内联,我最简单的方法是使用display: flexHere's a more in-depth guide on MDN.

.form-group {
   display: flex;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-10
    • 1970-01-01
    • 2015-11-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多