This answer helps to avoid a page break inside a single row of a table, however I am looking for a way to prevent a page break from occurring between two different rows. Let me explain my situation (apologies for formatting):
header: | Col1 | Col2 | Col3 | Col4 |
row 1: | Val1 | Val2 | Val3 | Val4 |
row 2: | Value relating to 1,2,3,4 |
row 3: | Val5 | Val6 | Val7 | Val8 |
row 4: | Value relating to 5,6,7,8 |
I have a table in which every two rows are related to each other, and should not be shown on separate pages. The second row in each pair has a single value that should be able to span over all the columns of that row.
I have tried the following using page-break-inside: avoid
:
- Putting the two rows inside a
<div>
tag - Having Col4 span over both rows (Col4 content just moves to next page)
- Putting both rows into a table (loses alignment with headings)