--- title: column-span slug: Web/CSS/column-span translation_of: Web/CSS/column-span --- <div>{{ CSSRef("CSS Multi-columns") }}</div> <h2 id="Summary" name="Summary">概述</h2> <p><a href="/en-US/docs/CSS" title="/en-US/docs/CSS">CSS</a> 属性<code>column-span</code> 的值被设置为<code>all</code>时,可以让一个元素跨越所有的列。一个跨越多列的元素被称为<strong>spanning element。</strong></p> <p>{{cssinfo}}</p> <h2 id="Syntax" name="Syntax">语法</h2> <pre class="twopartsyntaxbox"><a href="/en-US/docs/CSS/Value_definition_syntax" title="CSS/Value_definition_syntax">Formal syntax</a>: {{csssyntax("column-span")}} </pre> <pre>column-span: none; column-span: all; column-span: inherit; </pre> <h3 id="取值">取值</h3> <dl> <dt><code>none</code></dt> <dd>元素不跨多个列。</dd> <dt><code>all</code></dt> <dd>元素横跨所有列。元素出现之前,出现在元素之前的正常流中的内容在所有列之间自动平衡。该元素建立一个新的块格式上下文。</dd> </dl> <h2 id="Examples" name="Examples">例子</h2> <p>下例中的 h2 元素横跨 article 元素中的各列</p> <p> </p> <h3 id="HTML">HTML</h3> <pre><article> <h2>My Very Special Columns</h2> <p>This is a bunch of text split into three columns using the CSS `columns` property. The text is equally distributed over the columns.</p> </article> </pre> <h3 id="CSS">CSS</h3> <pre>article { columns: 3; } h2 { column-span: all; } </pre> <h3 id="Result">Result</h3> <p>{{EmbedLiveSample('Example', 'auto', 120)}}</p> <p> </p> <h2 id="Specifications" name="Specifications">规范</h2> <table class="standard-table"> <thead> <tr> <th scope="col">Specification</th> <th scope="col">Status</th> <th scope="col">Comment</th> </tr> </thead> <tbody> <tr> <td>{{ SpecName('CSS3 Multicol', '#column-span0', 'column-width') }}</td> <td>{{ Spec2('CSS3 Multicol') }}</td> <td> </td> </tr> </tbody> </table> <h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容性</h2> {{Compat("css.properties.column-span")}}