孤儿
语法
css
/* <integer> values */
orphans: 2;
orphans: 3;
/* Global values */
orphans: inherit;
orphans: initial;
orphans: revert;
orphans: revert-layer;
orphans: unset;
值
<integer>
-
可以单独留在片段底部的最小行数,在进行片段断开之前。值必须为正数。
正式定义
正式语法
orphans =
<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 orphans 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;
height: 150px;
columns: 3;
orphans: 3;
}
p {
background-color: #8ca0ff;
}
p:first-child {
margin-top: 0;
}
结果
规范
规范 |
---|
CSS 片段模块 Level 3 # widows-orphans |
浏览器兼容性
BCD 表格仅在浏览器中加载