Style orphansプロパティ
Style オブジェクト
定義と用法
orphans プロパティは、要素がページの下部に表示する必要がある最小行数を設定または返します(印刷または印刷プレビュー用)。
orphans プロパティはブロックレベル要素にのみ影響します。
ヒント:orphans:5 は、改ページの上に少なくとも 5 行が表示される必要があることを意味します。
ヒント:widows プロパティは、要素がページの上部に表示する必要がある最小行数を設定または返します。
構文
orphans プロパティを設定する:
Object.style.orphans="number|inherit"
orphans プロパティを返す:
Object.style.orphans
| 值 | 説明 |
|---|---|
| number | 表示可能な行の最小数を指定する整数。デフォルト値は 2 です。 |
| inherit | orphans プロパティの値は親要素から継承されます。 |
ブラウザサポート
![]()
![]()
![]()
![]()
![]()
Opera のみが orphans プロパティをサポートしています。
例
例
印刷または印刷プレビューの orphans プロパティを変更する:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>サンプル(example.com)</title>
<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>
</div>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>サンプル(example.com)</title>
<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>
</div>
</body>
</html>
試してみる »
Style オブジェクト その他の拡張