【发布时间】:2014-08-12 06:32:40
【问题描述】:
jsfiddle:http://jsfiddle.net/wngf9xy9/
HTML:
<div class="cont">
<label class="Label"> Label1 </label>
<input type="text" class="inp1" maxlength="11">
<select name="select1" id="select11" class="select1" >
<option value=""></option>
<option value="value1">value1</option>
</select>
<br>
<label class="Label"> Label2 </label>
<select name="select2" class="select2" >
<option value=""></option>
<option value="value2">value2</option>
</select>
</div>
CSS
.cont{
width: 300px;
}
.cont *{
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.cont label{
width: 22%;
display: inline-block;
}
.cont .inp1{
width: 20%;
height: 20px;
}
.cont .select1{
width: 53%; /*fallback*/
width: calc(58% - 15px);
margin-left: 15px;
height: 18px;
top: 0px;
}
.cont .select2{
width: calc(78% - 15px);
margin-left: 15px;
height: 18px;
top: 0px;
}
我有上面的 HTML/CSS 但由于某种原因最后一个选择溢出并转到第二行。我不明白为什么会这样。它们应该能够放在一行中吗?
【问题讨论】: