Skip to content

Commit 0e6f348

Browse files
committed
Improve print layout: use @page rules, physical units, and smart page breaks
1 parent 9b6401d commit 0e6f348

File tree

1 file changed

+35
-19
lines changed

1 file changed

+35
-19
lines changed

checklist.html

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -471,51 +471,65 @@
471471
/* =======================
472472
PRINT STYLES
473473
======================= */
474+
/* Tell the browser exactly how big the page is and the margins to use */
475+
@page {
476+
size: Letter portrait; /* use A4 if you prefer */
477+
margin: 0.5in; /* adjust to taste */
478+
}
479+
474480
@media print {
475481
body {
476482
background: white !important;
477483
color: black !important;
478484
padding-top: 0;
479485
}
480486

487+
/* Remove everything except the print cards */
481488
#navbar-placeholder,
482-
.nav-home,
489+
.page-header, /* hide the big header so only cards print */
483490
.legend,
484-
.table-container {
491+
.table-container,
492+
.nav-home {
485493
display: none !important;
486494
}
487495

488-
.header-card {
489-
box-shadow: none !important;
490-
border: 1px solid #bfbfbf !important;
491-
page-break-inside: avoid;
492-
margin-bottom: 1.5rem;
496+
/* Make the printable area fit inside margins and center it */
497+
html, body {
498+
width: 8.5in;
493499
}
494500

495-
/* Show print cards */
501+
.container {
502+
max-width: none !important;
503+
padding: 0 !important;
504+
}
505+
506+
/* Use inches so it reliably fits inside Letter (7.5in printable width with 0.5in margins) */
496507
.print-cards {
497508
display: block !important;
498-
max-width: 800px;
499-
margin: 0 auto;
509+
width: 7.25in; /* comfortably inside 7.5in printable area */
510+
margin: 0 auto; /* centers on the page */
500511
}
501512

513+
/* Let cards break across pages so space is used more evenly */
502514
.scenario-card {
503-
border: 2px solid #000;
504-
border-radius: 8px;
505-
margin-bottom: 1.5rem;
506-
page-break-inside: avoid;
507-
overflow: hidden;
515+
border: 1px solid #000;
516+
margin-bottom: 0.5rem;
517+
page-break-inside: auto; /* was avoid */
518+
break-inside: auto;
519+
box-shadow: none !important;
508520
-webkit-print-color-adjust: exact !important;
509521
print-color-adjust: exact !important;
510522
}
511523

524+
/* Keep the header with at least the first row, but allow body to flow */
512525
.scenario-card-header {
513526
background: #111 !important;
514527
color: #fff !important;
515-
padding: 0.75rem 1rem;
528+
padding: 8pt 10pt;
516529
font-weight: 700;
517-
font-size: 1.1rem;
530+
font-size: 12pt;
518531
border-bottom: 2px solid #000;
532+
break-after: avoid;
519533
-webkit-print-color-adjust: exact !important;
520534
print-color-adjust: exact !important;
521535
}
@@ -528,9 +542,11 @@
528542
.document-item {
529543
display: flex;
530544
justify-content: space-between;
531-
padding: 0.4rem 0;
545+
padding: 4pt 0;
532546
border-bottom: 1px dotted #ccc;
533-
font-size: 0.95rem;
547+
font-size: 10pt;
548+
page-break-inside: avoid;
549+
break-inside: avoid;
534550
}
535551

536552
.document-item:last-child {

0 commit comments

Comments
 (0)