我有一个包含 n 个元素的列表容器,我使用column-count
将其分成两列。
在某些情况下,列表中只能有一项。
我正在使用以下 CSS:
HTML:
<div class="list">
<div class="list-item">
The first problem is how the browser should handle one or more extra lines of content if the amount of content cannot fill up each column equally. In my opinion, the extra content should come at the bottom of the first columns, so that columns further to the right are never longer than columns further to the left. This is pretty standard practice in print design, and having it any other way just looks really strange. At least to me. Take a look and you decide
</div>
</div>
和CSS:
.list {-moz-column-count: 2; -webkit-column-count: 2; column-count: 2;}
.list-item {}
当列表中只有一项时,如何防止列数
将我的列表项拆分为两列?
最佳答案
添加...
display: -webkit-inline-box;
到列表项。
关于css - 防止列计数仅拆分容器中的一项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21311141/