Podział CSS po właściwości
Przykład
Zawsze wstawiaj podział strony po elemencie <footer>:
@media print
{
footer {
break-after: always;
}
}
Definicja i użycie
Właściwość break-after
określa, czy po określonym elemencie ma nastąpić podział strony, podział kolumny lub podział regionu.
Właściwość break-after
rozszerza właściwość CSS2 .
page-break-after
Używając break-after
, możesz powiedzieć przeglądarce, aby podzieliła stronę, kolumnę lub region po elemencie, do którego break-after
zastosowano właściwość, lub uniknąć podziału elementu na dwie strony.
Domyślna wartość: | automatyczny |
---|---|
Dziedziczny: | nie |
Animowalny: | nie. Przeczytaj o animacji |
Wersja: | CSS3 |
Składnia JavaScript: | obiekt .style.breakAfter="zawsze" |
Obsługa przeglądarki
Liczby w tabeli określają pierwszą wersję przeglądarki, która w pełni obsługuje tę właściwość.
Property | |||||
---|---|---|---|---|---|
break-after | 50.0 | 10.0 | 65.0 | 10.0 | 37.0 |
Składnia CSS
break-after: auto|all|always|avoid|avoid-column|avoid-page|avoid-region|column|left|page|recto|region|right|verso|initial|inherit;
Wartości nieruchomości
Value | Description |
---|---|
auto | Default. Automatic page/column/region break after the element |
all | Always insert a page-break right after the principal box |
always | Always insert a page-break after the element |
avoid | Avoid a page/column/region break after the element |
avoid-column | Avoid a column-break after the element |
avoid-page | Avoid a page-break after the element |
avoid-region | Avoid a region-break after the element |
column | Always insert a column-break after the element |
left | Insert one or two page-breaks after the element so that the next page is formatted as a left page |
page | Always insert a page-break after the element |
recto | Insert one or two page-breaks after the principal box so that the next page is formatted as a recto page |
region | Always insert a region-break after the element |
right | Insert one or two page-breaks after the element so that the next page is formatted as a right page |
verso | Insert one or two page-breaks after the principal box so that the next page is formatted as a verso page |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Więcej przykładów
Przykład
Zawsze wstawiaj podział strony po elemencie o identyfikatorze „toc” (spis treści):
@media print
{
#toc {
break-after: always;
}
}
Przykład
Zawsze wstawiaj podział regionu po elementach <ul> w regionie:
.region ul {
break-after: region;
}
}