0

为输入设置单独的 div 为标签设置单独的 div 是否正确?例如:

<div class="labels">
     <label for="place-name">Place name: </label>
     <label for="place-cat">Category: </label>
</div>

<div class="inputs">
     <input type="text" name="place-name">
     <select name="place-cat">
          <option value="value-01">Value 01</option>
          <option value="value-02">Value-02</option>
     </select>
</div>

先感谢您。

4

1 回答 1

0
You can use this 

<style>
.clear{
clear:both;
margin:5px;
padding:5px 0px;
}
.labels{
float:left;
width:100px;
}
.inputs{
float:left;
}
</style>

<div class="clear">
<div class="labels"><label for="place-name">Place name: </label></div>
<div class="inputs"><input type="text" name="place-name"></div>
</div>

<div class="clear">
<div class="labels"><label for="place-cat">Category: </label></div>
<div class="inputs"><select name="place-cat">
          <option value="value-01">Value 01</option>
          <option value="value-02">Value-02</option>
     </select></div>
</div>
于 2013-02-02T16:43:39.840 回答