Style orphans katangian
- 上一页 order
- 下一页 outline
- 返回上一层 HTML DOM Style Object
Pagsasakop at Paggamit
orphans
Ang katangian ay nagtatakda o binabalik ng pinakamaliit na bilang ng mga linya na dapat makikita sa ilalim ng pahina (ginagamit sa pagprint o pagbabalita ng pagprint).
orphans
Ang katangian ay nakakaapekto lamang sa mga bloke na elemento.
Tip:orphans:5
Ang oras na nagpapakita ng pahina ay dapat may 5 na mahahayag na linya sa itaas.
Tip:See Widows property To set or return the minimum number of lines that must be visible at the top of the page for an element.
Example
Change orphans and check the print or print preview:
<html> <head> <script> function ChangeOrphans() { document.getElementById("p1").style.orphans = document.getElementById("orphans").value; } </script> <style> .othercontent { width: 400px; border-top: 19cm solid #c3c3c3; } @page { /* Set the size of the print page */ size:21cm 27cm; margin-top:2cm; } @media print { .orphans { orphans:2; } } </style> </head> <body> <div class="othercontent"> <input id="orphans" value="2"> <button onclick="ChangeOrphans();">Change orphans</button> <p style="font-size:120%" id="p1"> Change orphans and view the print preview.<br> Line 2<br> Line 3<br> Line 4<br> Line 5<br> Line 6<br> Line 7<br> Line 8<br> </p> </body> </html>
Syntax
Return orphans property:
object.style.orphans
Set orphans property:
object.style.orphans = "number|initial|inherit"
Attribute Value
Value | Description |
---|---|
number | Integer, specifying the minimum number of visible lines. Negative values are not allowed. The default value is 2. |
initial | Set this property to its default value. See initial。 |
inherit | Inherit this property from its parent element. See inherit。 |
Technical Details
Default value: | 2 |
---|---|
Return value: | String, representing the minimum number of lines to be printed at the bottom of the page. |
CSS Version: | CSS2 |
Browser Support
表中的数字注明了首个完全支持该属性的浏览器版本。
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
25.0 | 8.0 | 不支持 | 3.1 | 10.0 |
- 上一页 order
- 下一页 outline
- 返回上一层 HTML DOM Style Object