widows
语法
css
/* <integer> values */
widows: 2;
widows: 3;
/* Global values */
widows: inherit;
widows: initial;
widows: revert;
widows: revert-layer;
widows: unset;
值
<integer>
-
可以在分段断开后单独保留在新片段顶部的最小行数。该值必须为正数。
正式定义
正式语法
widows =
<integer [1,∞]>
示例
控制列寡妇行
HTML
html
<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>
CSS
css
div {
background-color: #8cffa0;
columns: 3;
widows: 2;
}
p {
background-color: #8ca0ff;
}
p:first-child {
margin-top: 0;
}
结果
规范
规范 |
---|
CSS 分段模块级别 3 # widows-orphans |
CSS 多列布局模块级别 1 # filling-columns |
浏览器兼容性
BCD 表格仅在浏览器中加载