Styl wdowy Nieruchomości
Przykład
Zmień okna i sprawdź wydruk lub podgląd wydruku:
<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>
Spróbuj sam "
Definicja i użycie
Właściwość wdów ustawia lub zwraca minimalną liczbę wierszy dla elementu, który musi być widoczny u góry strony (do wydruku lub podglądu wydruku).
Właściwość wdów wpływa tylko na elementy blokowe.
Wskazówka: wdowy:5 oznacza, że pod podziałem strony musi być widocznych co najmniej 5 wierszy.
Wskazówka: Zobacz właściwość sieroty, aby ustawić lub zwrócić minimalną liczbę wierszy dla elementu, który musi być widoczny na dole strony.
Obsługa przeglądarki
Property | |||||
---|---|---|---|---|---|
widows | Yes | Not supported | Not supported | Not supported | Yes |
Składnia
Zwróć mienie wdowy:
object.style.widows
Ustaw właściwość wdów:
object.style.widows = "number|initial|inherit"
Wartości nieruchomości
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 |
Szczegóły techniczne
Domyślna wartość: | 2 |
---|---|
Wartość zwrotu: | String, reprezentujący minimalną liczbę wierszy do wydrukowania na górze strony |
Wersja CSS | CSS2 |
❮ Obiekt stylu