如果您愿意接受建议,您可以使用 display: inline 属性来做到这一点。
小提琴
例如 HTML
<div class="wrapper">
<label for="one">Text</label><br/>
<input id="one" type="text" value="1" />
</div>
<div class="wrapper">
<label for="tow">Text</label><br/>
<input id="two" type="text" value="2" />
</div>
<div class="wrapper">
<label for="three">Text</label><br/>
<input id="three" type="text" value="3" />
</div>
<div class="wrapper">
<label for="four">Text</label><br/>
<input id="four" type="text" value="4" />
</div>
<div class="wrapper">
<label for="five">Text</label><br/>
<input id="five" type="text" value="5" />
</div>
<div class="wrapper">
<label for="sel">*Select</label><br/>
<select id="sel">
<option>--Select--</option>
<option>1</option>
<option>2</option>
</select>
</div>
<div class="wrapper">
<label for="six">Text</label><br/>
<input id="six" type="text" value="6" />
</div>
<div class="wrapper">
<label for="seven">Text</label><br/>
<input id="seven" type="text" value="7" />
</div>
例如 CSS
.wrapper{
display: inline-block;
*display: inline;
zoom: 1;
}
input[type='text']{
width: 50px;
}