スタイル孤児プロパティ
例
孤立したものを変更し、印刷または印刷プレビューを確認します。
<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 size of printed 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 see 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>
自分で試してみてください»
定義と使用法
orphansプロパティは、ページの下部に表示する必要がある要素の最小行数を設定または返します(印刷または印刷プレビューの場合)。
orphansプロパティは、ブロックレベルの要素にのみ影響します。
ヒント: orphans:5は、ページ分割の上に少なくとも5行が表示されている必要があることを意味します。
ヒント:ページの上部に表示する必要がある要素の最小行数を設定または返すには、widowsプロパティを参照してください。
ブラウザのサポート
Property | |||||
---|---|---|---|---|---|
orphans | Yes | Not supported | Not supported | Not supported | Yes |
構文
orphansプロパティを返します。
object.style.orphans
orphansプロパティを設定します。
object.style.orphans = "number|initial|inherit"
プロパティ値
Value | Description |
---|---|
number | An integer that specifies the minimum number of visible lines. Negative values are not allowed. The default value is 2 |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
技術的な詳細
デフォルト値: | 2 |
---|---|
戻り値: | ページの下部に印刷する最小行数を表す文字列 |
CSSバージョン | CSS2 |
❮スタイルオブジェクト