<label for="rooms">Number of rooms</label> <select id="rooms"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> </select>
如果要将标签与输入相关联,而不使用ID,则可以通过将标签中包含所有输入来隐式分配:
<label>Number of rooms <select name="rooms"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> </select> </label>