CSS break-inside Property
Example
Avoid a page-break inside an <img> element:
@media print {
img {
display: block;
break-inside: avoid;
}
}
img {
display: block;
break-inside: avoid;
}
}
Definition and Usage
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 listst.
Default value: | auto |
---|---|
Inherited: | no |
Animatable: | no. |
Version: | CSS3 |
JavaScript syntax: | object.style.breakInside="always" |
- Inherited : "Inherited = no" means that it cannot takes (inherit) it's value from it's parent element.
- object - object in javascript means the element on which
break-inside
is applied. - Animatable - "Animatable = no" means that it cannot be animated with CSS
@keyframes
.
Browser Support
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 |
CSS Syntax
break-inside: auto|all|always|avoid|avoid-column|avoid-page|avoid-region|column|left|page|recto|region|right|verso|initial|inherit;
Property Values
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. |
inherit | Inherits this property from its parent element. |
More Examples
Example
Avoid a page-break inside a <table>, <ul>, <ol> elements::
@media print {
table, ul, ol {
break-inside: avoid;
}
}
table, ul, ol {
break-inside: avoid;
}
}
Comments
Post a Comment