diff --git a/doc/reference.html b/doc/reference.html
index 42fb5bd..dd00925 100644
--- a/doc/reference.html
+++ b/doc/reference.html
@@ -85,6 +85,9 @@ div.contents ul.contents {
}
.variable {
}
+h1, h2, h3, h4, h5, h6 {
+ page-break-inside: avoid;
+}
blockquote {
border: solid thin gray;
box-shadow: 3px 3px 5px rgba(0,0,0,0.5);
diff --git a/mxmldoc.c b/mxmldoc.c
index 1788d73..1535273 100644
--- a/mxmldoc.c
+++ b/mxmldoc.c
@@ -5422,6 +5422,9 @@ write_html_head(FILE *out, /* I - Output file */
"}\n"
".variable {\n"
"}\n"
+ "h1, h2, h3, h4, h5, h6 {\n"
+ " page-break-inside: avoid;\n"
+ "}\n"
"blockquote {\n"
" border: solid thin gray;\n"
" box-shadow: 3px 3px 5px rgba(0,0,0,0.5);\n"