blob: 9b9d2d8d2648c60c8c0f31d7ab08e461228e8697 (
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
|
---
title: widows
slug: Web/CSS/widows
translation_of: Web/CSS/widows
---
<div>{{CSSRef}}</div>
<p><a href="/en-US/docs/CSS">CSS</a>属性 <strong><code>widows</code></strong> 可以用来设置一个块级容器在新的<a href="/zh-CN/docs/Web/CSS/Paged_Media">分页</a>,区域或者<a href="/en-US/docs/Web/CSS/CSS_Columns">列</a>的<strong>顶部</strong>需要结合在一起的最小行数。</p>
<pre class="brush:css no-line-numbers notranslate">/* <integer> values */
widows: 2;
widows: 3;
/* Global values */
widows: inherit;
widows: initial;
widows: unset;
</pre>
<div class="note">
<p>在排版中,<em>widow</em> 指的是在新页面顶部单独出现的段落的最后一行。(这一行来自于上一个页面的段落)</p>
</div>
<h2 id="语法">语法</h2>
<h3 id="值">值</h3>
<dl>
<dt>{{cssxref("<integer>")}}</dt>
<dd>在一个片段打断后,新的片段顶部需要结合在一起的最小行数。该值必须为正值。</dd>
</dl>
<h2 id="Formal_definition">Formal definition</h2>
<p>{{CSSInfo}}</p>
<h2 id="Formal_syntax">Formal syntax</h2>
<pre class="syntaxbox notranslate">{{CSSSyntax}}</pre>
<h2 id="示例">示例</h2>
<h3 id="控制列布局中的_widows">控制列布局中的 widows</h3>
<h4 id="HTML">HTML</h4>
<pre class="brush: html notranslate"><div>
<p>This is the first paragraph containing some text.</p>
<p>This is the second paragraph containing some more text than the first one. It is used to demonstrate how widows work.</p>
<p>This is the third paragraph. It has a little bit more text than the first one.</p>
</div>
</pre>
<h4 id="CSS">CSS</h4>
<pre class="brush: css; highlight[4] notranslate">div {
background-color: #8cffa0;
columns: 3;
widows: 2;
}
p {
background-color: #8ca0ff;
}
p:first-child {
margin-top: 0;
}
</pre>
<h4 id="结果">结果</h4>
<p>{{EmbedLiveSample("Controlling_column_widows", 400, 160)}}</p>
<h2 id="规范">规范</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 Fragmentation', '#widows-orphans', 'widows')}}</td>
<td>{{Spec2('CSS3 Fragmentation')}}</td>
<td>Extends <code>widows</code> to apply to any type of fragment, including pages, regions, or columns.</td>
</tr>
<tr>
<td>{{SpecName('CSS3 Multicol', '#filling-columns', 'widows')}}</td>
<td>{{Spec2('CSS3 Multicol')}}</td>
<td>Recommendations to consider <code>widows</code> in relation to columns.</td>
</tr>
<tr>
<td>{{SpecName('CSS2.1', 'page.html#break-inside', 'widows')}}</td>
<td>{{Spec2('CSS2.1')}}</td>
<td>Initial definition.</td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<div>
<p>{{Compat("css.properties.widows")}}</p>
</div>
<h2 id="另请参见">另请参见</h2>
<ul>
<li>{{cssxref("orphans")}}</li>
<li><a href="/en-US/docs/Web/CSS/Paged_Media">Paged media</a></li>
</ul>
|