Style orphans 屬性
- 上一頁 order
- 下一頁 outline
- 返回上一層 HTML DOM Style 對象
定義和用法
orphans
屬性設置或返回必須在頁面底部可見的元素的最小行數(用于打印或打印預覽)。
orphans
屬性只影響塊級元素。
提示:orphans:5
表示分頁符上方必須至少有 5 行可見。
提示:請參閱 widows 屬性 以設置或返回必須在頁面頂部可見的元素的最小行數。
實例
更改 orphans 并檢查打印或打印預覽:
<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 { /* 設置打印頁面的尺寸 */ 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();">更改 orphans</button> <p style="font-size:120%" id="p1"> 更改 orphans 并查看打印預覽。<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>
語法
返回 orphans 屬性:
object.style.orphans
設置 orphans 屬性:
object.style.orphans = "number|initial|inherit"
屬性值
值 | 描述 |
---|---|
number | 整數,規定最小可見行數。不允許使用負值。默認值為 2。 |
initial | 將此屬性設置為其默認值。請參閱 initial。 |
inherit | 從其父元素繼承此屬性。請參閱 inherit。 |
技術細節
默認值: | 2 |
---|---|
返回值: | 字符串,表示在頁面底部打印的最小行數。 |
CSS 版本: | CSS2 |
瀏覽器支持
表中的數字注明了首個完全支持該屬性的瀏覽器版本。
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
25.0 | 8.0 | 不支持 | 3.1 | 10.0 |
- 上一頁 order
- 下一頁 outline
- 返回上一層 HTML DOM Style 對象