css - 防止列计数仅拆分容器中的一项

标签 css

我有一个包含 n 个元素的列表容器,我使用column-count 将其分成两列。

在某些情况下,列表中只能有一项。

我正在使用以下 CSS:

http://jsfiddle.net/ny3Rc/4/

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/

相关文章:

jQuery UI Draggable 在绝对定位项下方拖动

javascript - jQuery - 根据屏幕宽度将像素添加到高度

PHP - JS 和 CSS 压缩器

javascript - 如何使用 Javascript、CSS 和 HTML 加速移动设备的滑动和滚动?

javascript - 在 translateX 后将跨度元素居中对齐

html - 垂直居中的一个 Div 占一个固定的 Bar Up Top

php - 如何在跑马灯中显示 mysql 数据?

JavaScript 函数 : Add CSS Class if session variable not equal to X

javascript - ng 风格间歇性工作

javascript - 背景图像在第一次滚动时跳转