无法在小尺寸的同一行上设置输入

时间:2018-12-07 16:53:38

标签: css bootstrap-4

我正在尝试在同一行上以最小尺寸添加两个输入字段,我尝试这样做:

<div class="row">
 <input type="number" class="form-control" class="slider-start" data-id="1">
 <input type="number" class="form-control" class="slider-end" data-id="1">
</div>

this is a fiddle

3 个答案:

答案 0 :(得分:1)

Flexbox应该可以为您提供帮助。

.form-control{
  width: 35%; /*size of input box*/
  flex-flow: row nowrap; /*sets flex-box elements order*/
}

.row {
  display: flex;
}

希望我能帮上忙。

答案 1 :(得分:0)

尝试在样式中添加inline-flex

<div class="row" style="display: inline-flex;">
  <input type="number" class="form-control" class="slider-start" data-id="1">
  <input type="number" class="form-control" class="slider-end" data-id="1">
</div>

答案 2 :(得分:0)

你的意思是这样吗?

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
    <div class="row">
        <div class="col-auto">
            <input type="number" class="form-control" class="slider-start" data-id="1">
        </div>
        <div class="col-auto">
            <input type="number" class="form-control" class="slider-end" data-id="1">
        </div>
    </div>