Gaya janda Properti
Contoh
Ubah janda dan periksa pratinjau cetak atau cetak:
<html>
<head>
<script>
function ChangeWidows()
{
document.getElementById("p1").style.widows = document.getElementById("widows").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
{
.widows
{
widows:2;
}
}
</style>
</head>
<body>
<div class="othercontent">
<input id="widows" value="2">
<button onclick="ChangeWidows();">Change widows</button>
<p style="font-size:120%" id="p1">
Change widows 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>
<div class="othercontent">
</body>
</html>
Cobalah sendiri "
Definisi dan Penggunaan
Properti janda menetapkan atau mengembalikan jumlah baris minimum untuk elemen yang harus terlihat di bagian atas halaman (untuk pencetakan atau pratinjau cetak).
Properti janda hanya mempengaruhi elemen tingkat blok.
Tip: Widows:5 berarti setidaknya 5 baris harus terlihat di bawah page break.
Tip: Lihat properti anak yatim untuk mengatur atau mengembalikan jumlah baris minimum untuk elemen yang harus terlihat di bagian bawah halaman.
Dukungan Peramban
Property | |||||
---|---|---|---|---|---|
widows | Yes | Not supported | Not supported | Not supported | Yes |
Sintaksis
Kembalikan properti janda:
object.style.widows
Setel properti janda:
object.style.widows = "number|initial|inherit"
Nilai properti
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 |
Detail Teknis
Nilai Bawaan: | 2 |
---|---|
Nilai Kembali: | Sebuah String, mewakili jumlah minimum baris untuk dicetak di bagian atas halaman |
Versi CSS | CSS2 |
Objek Gaya