Skip to content

Commit da7156c

Browse files
brabojclaude
andauthored
feat: add print styles for chapters (#216)
Hide nav, sidebars, FAB, and footer when printing. Prevent page breaks after headings and inside images. Wrap long code blocks. Closes #214 Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ab7f9f7 commit da7156c

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

astro-site/src/styles/global.css

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,3 +672,43 @@ a:hover {
672672
padding: var(--space-lg) var(--space-md);
673673
}
674674
}
675+
676+
@media print {
677+
.site-header-bar,
678+
.site-tabs-bar,
679+
.sidebar-toc,
680+
.sidebar-tutorials,
681+
.resize-handle,
682+
.mobile-toc,
683+
.site-footer,
684+
.skip-link {
685+
display: none !important;
686+
}
687+
688+
.site-main {
689+
display: block;
690+
}
691+
692+
.content {
693+
padding: 0;
694+
max-width: 100%;
695+
}
696+
697+
a {
698+
color: inherit;
699+
text-decoration: underline;
700+
}
701+
702+
pre {
703+
white-space: pre-wrap;
704+
border: 1px solid #ccc;
705+
}
706+
707+
img {
708+
break-inside: avoid;
709+
}
710+
711+
h2, h3, h4 {
712+
break-after: avoid;
713+
}
714+
}

0 commit comments

Comments
 (0)