Page 1 of 1

Shade box page break padding

Posted: Tue Aug 26, 2025 4:29 pm
by Leighb
I am using Oxygen 27.1 and Chemistry 27.1. I have some content in a div that is styled to have a gray background. Sometimes that content with the gray background is too long for one page and rolls over to a new page. The break at the bottom of the first page leaves the content too tight to the bottom edge of the gray box and the content on the next page leaves the content too close to the top of the gray box. How can I add padding to the content break for this naturally occurring page break so the gray box isn't so tight to the text?
2025-08-25_16-48-00.png
Thanks,
Leigh

Re: Shade box page break padding

Posted: Wed Aug 27, 2025 11:05 am
by julien_lacour
Hello Leigh,

Unfortunately, CSS does not provide a way to apply padding/margin inside an element split by a page break.
If you are using DITA and the DITA Map PDF - based on HTML5 & CSS scenario, as a workaround you could mark the split paragraph with @outputclass="page-break-avoid" so it will be move into the next page, then change the default paragraphs margins in padding:

Code: Select all

*[class ~= "topic/p"] {
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 1em;
  padding-bottom: 0.5em;
}
For more information about force page-breaks you can check our user guide.

Regards,
Julien

Re: Shade box page break padding

Posted: Thu Aug 28, 2025 12:21 am
by Leighb
Thanks Julien. That works!
Leigh