Thuộc tính đột phá CSS
Ví dụ
Tránh ngắt trang bên trong phần tử <img>:
@media print
{
img {
display: block;
break-inside:
avoid;
}
}
Định nghĩa và cách sử dụng
Thuộc tính break-inside
chỉ định xem việc ngắt trang, ngắt cột hoặc ngắt vùng có xảy ra bên trong phần tử được chỉ định hay không.
Thuộc tính break-inside
mở rộng sau đó là thuộc tính page-break-inside
của CSS2.
Với break-inside
, bạn có thể yêu cầu trình duyệt tránh ngắt quãng bên trong hình ảnh, đoạn mã, bảng và danh sách.
Giá trị mặc định: | tự động |
---|---|
Thừa hưởng: | KHÔNG |
Hoạt hình: | KHÔNG. Đọc về hoạt hình |
Phiên bản: | CSS3 |
Cú pháp JavaScript: | đối tượng .style.breakInside="luôn luôn" |
Hỗ trợ trình duyệt
Các số trong bảng chỉ định phiên bản trình duyệt đầu tiên hỗ trợ đầy đủ thuộc tính.
Property | |||||
---|---|---|---|---|---|
break-inside | 50.0 | 10.0 | 65.0 | 10.0 | 37.0 |
Cú pháp CSS
break-inside: auto|all|always|avoid|avoid-column|avoid-page|avoid-region|column|left|page|recto|region|right|verso|initial|inherit;
Giá trị tài sản
Value | Description |
---|---|
auto | Default. Automatic page/column/region break inside the element |
avoid | Avoid a page/column/region break inside the element |
avoid-column | Avoid a column-break inside the element |
avoid-page | Avoid a page-break inside the element |
avoid-region | Avoid a region-break inside the element |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Thêm ví dụ
Ví dụ
Tránh ngắt trang bên trong các phần tử <table>, <ul>, <ol>::
@media print
{
table, ul, ol {
break-inside: avoid;
}
}