【问题标题】:Inline form input with label over input centered内联表单输入,带有标签的输入居中
【发布时间】:2018-05-19 23:10:32
【问题描述】:

我在每个输入上都有一个带有长标签的表单,我希望输入在每个标签下方居中,但我还需要输入保持内联。它应该如下所示,但输入应该在每个长标签下居中。

这是我所拥有的,但我无法在标签下设置输入中心。

.question-container {
  width: 1000px;
  margin: 0 auto;
}

#questions {
  margin: 5px 30px;
  display: inline-block
}
<div class="form-inline">
    <span id="questions">
        <label>How much will your house cost?</label>
        <input class="form-control" type="text" placeholder="input">
      </span>
    <span id="questions">
        <label>What is the most you can pay monthly?</label>
        <input class="form-control" type="text" placeholder="input">
      </span>
    <span id="questions">
        <label>What is your Current Monthly Rent?</label>
        <input class="form-control" type="text" placeholder="input">
      </span>
  </div>
  <div id='centered'>
    <button type="submit" class="btn btn-primary mb-2">Submit</button>
  </div>

任何帮助将不胜感激!

【问题讨论】:

  • Bootstrap 4 没有 col-xs 类,它被重命名为 col

标签: html css bootstrap-4


【解决方案1】:

知道了!

只需将text-align:center; 添加到跨度

#questions {
   margin:5px 30px;
   display:inline-block;
   text-align:center;
}

【讨论】:

    猜你喜欢
    • 2016-09-25
    • 1970-01-01
    • 2014-08-19
    • 1970-01-01
    • 1970-01-01
    • 2020-01-25
    • 2013-09-03
    • 1970-01-01
    • 2015-03-15
    相关资源
    最近更新 更多