我正在尝试在无序列表中创建两列。我已经取得了一定的成功,但是,我不想为它指定宽度,ul
而是li span
让它占据其父级的所有宽度(即div
)。我该怎么做?谢谢
CSS
div {
width:300px;
}
ul {
width:200px;
}
li span {
width: 170px;
display:inline-block;
padding-left: 10px;
vertical-align: top;
}
HTML
<div>
<ul>
<li>
<input type="checkbox" value="1" name="someName[]"><span>Some short text</span>
</li>
<li>
<input type="checkbox" value="2" name="someName[]"><span>Some very very very very very very long text</span>
</li>
<li>
<input type="checkbox" value="3" name="someName[]"><span>Some short text</span>
</li>
</ul>
</div>