前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >元素下方超出换列

元素下方超出换列

作者头像
阿超
发布2023-05-11 19:05:34
1780
发布2023-05-11 19:05:34
举报
文章被收录于专栏:快乐阿超快乐阿超

根本不应该为取悦别人而使自己失敬于人——卢俊

我们有时候需要这种需求:元素高度超出后换到下一列

则可以使用column-count

column-count可以指定最大列数

代码语言:javascript
复制
column-count: 3;
column-count: auto;

column-count: inherit;
column-count: initial;
column-count: unset;

简写属性:columns

代码语言:javascript
复制
/* Column width */
columns: 18em;

/* Column count */
columns: auto;
columns: 2;

/* Both column width and count */
columns: 2 auto;
columns: auto 12em;
columns: auto auto;

/* Global values */
columns: inherit;
columns: initial;
columns: unset;

例子:

HTML

代码语言:javascript
复制
<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

代码语言:javascript
复制
.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.

into three columns using the text is equally distributed

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2023-05-09,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档