我正在使用eonasdan datetimepicker和bootstrap 3.我有一个datetimepicker设置为calander而另一个设置为时间。我希望能够将它们并排放在同一条线上。但是如果不破坏datetimepicker,我就无法弄明白。这是我的代码:
<form role="form">
<div class="form-group">
<div class="form-group">
<label for="class">Class:</label> <select multiple
class="form-control" size="2">
<option value="1">Class 1</option>
<option value="2">Class 2</option>
</select>
</div>
<div class="form-group">
</div>
<div class="form-group">
<!-- Date Picker -->
<div class="input-group date" id="startDate">
<input type='text' class="form-control" /> <span
class="input-group-addon"><span
class="glyphicon glyphicon-calendar"></span> </span>
</div>
</div>
<div class="form-group">
<!-- Time Picker -->
<div class="input-group date" id="startTime">
<input type='text' class="form-control" /> <span
class="input-group-addon"><span class="glyphicon glyphicon-time"></span>
</span>
</div>
</div>
<button type="submit" class="btn btn-default">Submit</button>
</div>
</form>
And here is a JSFiddle where the date picker doesn't work but other than that ok.我也不能强迫多重选择由于某种原因只有2行高?
TIA
答案 0 :(得分:2)
这似乎是一个 css 问题,可以 重写 。将datepicker
和Timepicker
放在div
之内
<div class="form-group">
<!-- Date Picker -->
<div class="input-group date " id="startDate">
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
<!-- Time Picker -->
<div class="input-group date" id="startTime">
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-time"></span>
</span>
</div>
</div>
然后使用CSS:
#startDate, #startTime {
width: 50%;
float: left;
}
注意:为宽度使用%值以使其保持响应
答案 1 :(得分:2)
请你检查一下。 http://jsfiddle.net/6FcBT/2/
<div class="form-group">
<!-- Date Picker -->
<div class="input-group date" id="startDate">
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar" />
</span>
<!-- Time Picker -->
<div class="input-group date" id="startTime">
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-time" />
</span>
</div>
</div>
</div><!--end form-group-->
您不需要多个表单组元素。如果你使用其中一个,你可以并排看到datepicker元素。