--- title: column-count slug: Web/CSS/column-count tags: - CSS3 Multiple column layout - CSS3多列布局 translation_of: Web/CSS/column-count ---
{{CSSRef}}
 

column-count CSS属性,描述元素的列数。

column-count: 3;
column-count: auto;

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

语法

{{cssinfo}}

取值

auto
用来表示列的数量由其他CSS属性指定, 例如 {{cssxref("column-width")}}.
<number>
是个严格的正数 {{cssxref("<integer>")}} ,用来描述元素内容被划分的理想列数. 假如 {{cssxref("column-width")}}也被设置为非零值, 此参数仅表示所允许的最大列数. 

例子

.content-box {
  border: 10px solid #000000;
  column-count:3;
}

规范

Specification Status Comment
{{SpecName('CSS3 Multicol', '#column-count', 'column-count')}} {{Spec2('CSS3 Multicol')}}  

 

浏览器兼容性

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{CompatVersionUnknown}}{{property_prefix('-webkit')}} {{compatGeckoDesktop("1.8")}}{{property_prefix('-moz')}} 10 11.1 3.0 (522){{property_prefix('-webkit')}}
on display: table-caption {{CompatVersionUnknown}} {{compatGeckoDesktop("37")}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{CompatVersionUnknown}} {{compatGeckoMobile("1.8")}}{{property_prefix('-moz')}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
on display: table-caption {{CompatVersionUnknown}} {{compatGeckoMobile("37")}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}

 

了解更多

https://www.w3.org/TR/css3-multicol/

https://caniuse.com/#search=column