html - 如何对齐输入表单?

标签 html css twitter-bootstrap

我在前端开发方面并不强:)我正在使用 Bootstrap 来创建表单。但看起来不太好。如何将输入表单对齐在一列中?

<form>
    <div class="form-group form-inline">
        <label for="exampleInputPrice" class="personal-form-labels">Purchase Price</label>
        <input type="text" class="form-control" id="exampleInputPrice" placeholder="$$$">
    </div>
    <div class="form-group form-inline">
        <label for="exampleInputLoan" class="personal-form-labels">Loan Amont</label>
        <input type="text" class="form-control" id="exampleInputLoan" placeholder="$$$">
    </div>
    <div class="col-md-12 text-center block-buttons">
        <button type="submit" class="btn btn-primary btn-lg">Continue</button>
    </div>
</form>

enter image description here

最佳答案

Use of display:table-*

table {
  border-collapse: separate;
}

.form-inline {
  display: table-row;
}

.form-inline label, .form-inline input {
  display: table-cell;
  margin: 0 0 5px 10px;
}
<form>
  <div class="form-group form-inline">
    <label for="exampleInputPrice" class="personal-form-labels">Purchase Price</label>
    <input type="text" class="form-control" id="exampleInputPrice" placeholder="$$$">
  </div>
  <div class="form-group form-inline">
    <label for="exampleInputLoan" class="personal-form-labels">Loan Amont</label>
    <input type="text" class="form-control" id="exampleInputLoan" placeholder="$$$">
  </div>
  <div class="col-md-12 text-center block-buttons">
    <button type="submit" class="btn btn-primary btn-lg">Continue</button>
  </div>
</form>

关于html - 如何对齐输入表单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47937132/

相关文章:

html - 如何使我的页面响应任何屏幕尺寸?

php - 表单提交变量未检索数据

css - 如何检查浏览器的默认 css 设置?

html - 列放置问题内的 Bootstrap 列

html - 导航栏和侧边栏同时使用 Bootstrap ?

javascript - 如何设置 iframe 在使用 jQuery 完成加载后自动平滑滚动到底部

javascript - 使用 Bootstrap col-xs 时的 JQuery 验证问题

html - 如何使用 CSS 文件使 HTML 中的表格居中?

javascript - Bootstrap 4 - 避免屏幕点击模式关闭

html - z-index 阻止滚动框在 CSS 中工作