如果我理解正确,您想删除 LI 之间的空格吗?这就是我得到的。将整个 UL 封装在父元素中。
<div id="test">
<ul class="discussions">
<li class="discussion btn btn-primary">Not so long text</li>
<li class="discussion btn btn-primary">Very very long text with lot of words.</li>
<li class="discussion btn btn-primary">Another long text foobar.</li>
<li class="discussion btn btn-primary">I'm short</li>
<li class="discussion btn btn-primary">I'm so short</li>
<li class="discussion btn btn-primary">And me?</li>
<li class="discussion btn btn-primary">Shut up</li>
<li class="discussion btn btn-primary">Ok, sorry... peace bro</li>
</ul>
</div>
然后,将其添加到您的 CSS
#test{
font-size: 0px;
}
li
{
margin: 0px !important;
font-size: 12; //this can be varied depending on your desired font size
}