我试图在选择框前面添加标签,我已将包含这两个元素的 div 标签设置为“inline-block”。但是,跨度仍在选择框的顶部。
<div class="unselected-field" style="display: inline-block;" id="selectCountry">
<span>test</span><select id="countrySelect" name="countrySelect"></select>
</div>
有什么想法吗?我在使用 Chrome...
最佳答案
我通常将标签包裹在输入的周围:
<div class="unselected-field" style="display: inline-block;" id="selectCountry">
<label>Test:<select id="countrySelect" name="countrySelect">
<option>Option 1</option>
</select>
</label>
</div>
关于html - 在下拉列表前添加文本标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9762462/