Avoid a page-break inside an <img> element:
@media print {
img {
display: block;
break-inside: avoid;
}
}
The break-inside
property specifies whether or not a page break, column break, or region break should occur inside the specified element.
The break-inside
property extends then CSS2 page-break-inside
property.
With break-inside
, you can tell the browser to avoid breaks inside images, code snippets, tables, and lists.
Default value: | auto |
---|---|
Inherited: | no |
Animatable: | no. Read about animatable |
Version: | CSS3 |
JavaScript syntax: | object.style.breakInside="always" |
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
break-inside | 50.0 | 10.0 | 65.0 | 10.0 | 37.0 |
break-inside: auto|all|always|avoid|avoid-column|avoid-page|avoid-region|column|left|page|recto|region|right|verso|initial|inherit;
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 |
Avoid a page-break inside a <table>, <ul>, <ol> elements::
@media print {
table, ul, ol {
break-inside: avoid;
}
}
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!