表格,标签和输入的单独div

时间:2013-02-02 15:30:54

标签: html forms

输入单独的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>

提前谢谢。

1 个答案:

答案 0 :(得分: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>