我使用这段代码创建了一个包含文本框的下拉菜单:https://stackoverflow.com/a/27547021
现在,我想移动这个下拉菜单的位置,以与某个tekst对齐。理想情况下,我希望它位于“Tekstpiece”的右侧。我尝试调整CSS,如下所示:https://www.w3schools.com/code/tryit.asp?filename=GDUL1WPE82S0
但是,下拉框的内容不会随框本身移动。此外,硬编码位置可能不是最好的选择。
对如何实现这一点有什么想法?
发布于 2020-04-16 18:39:40
将您的html更改为:
<!DOCTYPE html>
<html>
<h3>Tekstpiece</h3>
<form>
<div class="multiselect">
<div class="selectBox" onclick="showCheckboxes()">
<select>
<option>Select an option</option>
</select>
<div class="overSelect"></div>
<div id="checkboxes">
<label for="one">
<input type="checkbox" id="one" />First checkbox</label>
<label for="two">
<input type="checkbox" id="two" />Second checkbox</label>
<label for="three">
<input type="checkbox" id="three" />Third checkbox</label>
</div>
</div>
</div>
</form>
</html>
假设您想要下拉复选框与选择框“对齐”。
https://stackoverflow.com/questions/61225532
复制相似问题