为什么这个DIV看起来不同?
第一:
<div data-role="fieldcontain">
<fieldset data-role="controlgroup">
<legend>City</legend>
<input type="text" id="select_team_city" value="" placeholder="Type Team City"/>
</fieldset>
</div>
第二:
<div data-role="fieldcontain">
<label for="select_team_name">Name</label>
<input type="text" id="select_team_name" value="" placeholder="Type Team Name"/>
</div>
嗯,我不确定我是否正确理解。它们看起来不同,因为图例除了标签之外还有其他作用
根据 w3c,图例将相关元素分组到表单(例如多个字段)
http://www.w3schools.com/tags/tag_legend.asp
而标签为输入元素定义标签
http://www.w3schools.com/tags/tag_label.asp
请参阅此处的示例,或考虑以下内容。我不确定您要实现的目标,但以下是我对这些标签用法的理解:
<div data-role="fieldcontain">
<fieldset data-role="controlgroup">
<legend>Team Information</legend>
<label for="select_team_city">City</label>
<input type="text" id="select_team_city" value="" placeholder="Type Team City"/>
<label for="select_team_name">Name</label>
<input type="text" id="select_team_name" value="" placeholder="Type Team Name"/>
</fieldset>
</div>
请参阅此处的工作示例:http://jsfiddle.net/C3CR2/2/