我遇到了一些显示两个跨度的 UI 问题,每个跨度都有一堆复选框。HTML 看起来像:
<strong>Areas Impacted</strong>
<div class="arealist">
<span class="group"><label><input type="checkbox" />Select All</label></span>
<span class="areas">
<label><input type="checkbox" />Item 1</label>
<label><input type="checkbox" />Item 2</label>
<label><input type="checkbox" />Item 3</label>
<label><input type="checkbox" />Item 4</label>
<label><input type="checkbox" />Item 5</label>
<label><input type="checkbox" />Item 6</label>
<label><input type="checkbox" />Item 7</label>
</span>
</div>
我有以下CSS:
div.arealist { display: block; clear: both; margin-top: 40px; }
div.arealist>span { display: inline; padding: 25px; }
div.arealist>span label { display: inline; }
div.arealist>span.group { width: 75px; border: 1px solid #d0d0d0; }
div.arealist>span.areas { width: 300px; border: 1px solid #d0d0d0; }
它看起来像这样:
这有两个问题。首先,右侧的复选框与边框一起渗入左侧框。Select All文本应在其自己的范围内,并且项目列表将全部位于右侧框中。第二个问题是第 4 项复选框被分成两行。我想将<label>
标签视为一个单元,永远不要跨越多行。
我究竟做错了什么?