Styl sieroty Własność
Przykład
Zmień sieroty i sprawdź wydruk lub podgląd wydruku:
<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>
Spróbuj sam "
Definicja i użycie
Właściwość sieroty ustawia lub zwraca minimalną liczbę wierszy dla elementu, który musi być widoczny na dole strony (do wydruku lub podglądu wydruku).
Właściwość sieroty wpływa tylko na elementy blokowe.
Wskazówka: sieroty:5 oznacza, że nad podziałem strony musi być widocznych co najmniej 5 wierszy.
Wskazówka: Zobacz właściwość wdów, aby ustawić lub zwrócić minimalną liczbę wierszy dla elementu, który musi być widoczny u góry strony.
Obsługa przeglądarki
Property | |||||
---|---|---|---|---|---|
orphans | Yes | Not supported | Not supported | Not supported | Yes |
Składnia
Zwróć mienie sierot:
object.style.orphans
Ustaw właściwość sieroty:
object.style.orphans = "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 dole strony |
Wersja CSS | CSS2 |
❮ Obiekt stylu