aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/column-span/index.html
blob: 1f24023c88d384e28ab6a9912a2c67b2a7d53d53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
---
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>&lt;article&gt;
  &lt;h2&gt;My Very Special Columns&lt;/h2&gt;
  &lt;p&gt;This is a bunch of text split into three columns
     using the CSS `columns` property. The text
     is equally distributed over the columns.&lt;/p&gt;
&lt;/article&gt;
</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>

<p>{{ CompatibilityTable() }}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari (WebKit)</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{ CompatVersionUnknown() }}{{ property_prefix('-webkit') }}</td>
   <td>{{ CompatNo() }}</td>
   <td>10</td>
   <td>11.1+</td>
   <td>{{ CompatVersionUnknown() }}{{ property_prefix('-webkit') }}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Chrome for Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{ CompatVersionUnknown() }}{{ property_prefix('-webkit') }}</td>
   <td>{{ CompatVersionUnknown() }}{{ property_prefix('-webkit') }}</td>
   <td>{{ CompatNo() }}</td>
   <td>{{ CompatUnknown() }}</td>
   <td>11.1+</td>
   <td>{{ CompatVersionUnknown() }}{{ property_prefix('-webkit') }}</td>
  </tr>
 </tbody>
</table>
</div>