根本不应该为取悦别人而使自己失敬于人——卢俊
我们有时候需要这种需求:元素高度超出后换到下一列
则可以使用column-count
column-count
可以指定最大列数
1 | column-count: 3; |
简写属性:columns
1 | /* Column width */ |
例子:
HTML
1
2
3
4
5 <p class="content-box">
This is a bunch of text split into three columns
using the CSS `columns` property. The text
is equally distributed over the columns.
</p>CSS
1
2
3 .content-box {
columns: 3 auto;
}Result
This is a bunch of text split into three columns using the CSS `columns` property. The text is equally distributed over the columns.