DOM Style orphans 属性控制在旧页面上拆分的段落中的最小行数。孤儿的默认值是继承的或 2(这意味着如果要拆分段落,页面上将至少保留 2 行)。
DOM Style orphans 属性控制在旧页面上拆分的段落中的最小行数。孤儿的默认值是继承的或 2(这意味着如果要拆分段落,页面上将至少保留 2 行)。
句法:
object.style.orphans
object.style.orphans = "number|initial|inherit"
属性值:
- Number:一个整数,它指定在页面或列的末尾可以留下的行数。不允许使用负值。默认值为 2。
- Initial:将元素设置为其初始值。
- 继承:元素从父元素继承其孤儿属性。
示例 1:为孤儿财产设置狮子的数量。
HTML | DOM Style orphans Property
Cascading Style Sheets (CSS) is a style
sheet language used for describing the
presentation of a document written in a
markup language like HTML.[1] CSS is a
cornerstone technology of the World Wide
Web, alongside HTML and JavaScript.
CSS is designed to enable the separation
of presentation and content, including
layout,colors, and fonts.CSS has a simple
syntax and uses a number of English keywords
to specify the names of various style
properties.A style sheet consists of a list
of rules. Each rule or rule-set consists of
one or more selectors,and a declaration block.
This separation can improve content accessibility,
provide more flexibility and control in the
specification of presentation characteristics,
enable multiple web pages to share formatting
by specifying the relevant CSS in a separate .css
file, and reduce complexity and repetition in
the structural content.
Separation of formatting and content also makes
it feasible to present the same markup page in
different styles for different rendering methods,
such as on-screen, in print, by voice
(via speech-based browser or screen reader),
and on Braille-based tactile devices. CSS also
has rules for alternate formatting if the content
is accessed on a mobile device.
The name cascading comes from the specified
priority scheme to determine which style rule
applies if more than one rule matches a particular
element. This cascading priority scheme is predictable.
输出:根据 orphans 属性,如果要拆分段落,页面或列上将至少保留 5 行(因为我们在代码中设置了 orphans 属性“5”)。
支持的浏览器: HTML支持的浏览器 |下面列出了DOM Style orphans 属性:
- 谷歌浏览器 25+
- 浏览器 8+
- 歌剧 9.2+