Safari page-break-inside:avoid not working

后端 未结 1 860

I have a problem with CSS page-break-inside: avoid. I have some printing blocks which have this css attribute set, however Safari breaks any content just as the

相关标签:
1条回答
  • 2021-01-04 10:19

    Try using display: inline-block; instead of page-break-inside: avoid;. You may also want to add vertical-align: top; and width: 100%; to make the elements behave like normal block elements instead of inline elements.

    This technique has been working reliably since long before page-break-inside: avoid; was implemented in most browsers. It's still the most reliable cross-platform way to prevent page breaks in a block of content.

    If you want to make a table unbreakable, you can set display: inline-table; on it. Or you can just put it in an inline-block div.

    0 讨论(0)
提交回复
热议问题