--- 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> {{CSSSyntax}} <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>