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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…