Avoid page break after headings

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
andy_smith
Propeller Head
Posts: 24
Joined: Wed Jun 16, 2021 5:41 am

Avoid page break after headings

Post by andy_smith »

I’m looking for the stylesheet code to set a heading to keep with next so that the heading doesn’t appear at the bottom of a page and instead stays with the following paragraph on the next page.

I’ve found this but it doesn’t seem to work: page- page-break-after: avoid;

I also found a note that it’s now been replaced by: break-after: avoid;
but that didn’t seem to work either.

Does anyone have any ideas? I’ve put it both in the normal headings and in the @media print headings (my targets are all PDFs) but nothing seems to work.
I'm on UK time (UTC+0). I work Tuesday, Wednesday and Thursday so I may not see replies outside of those days.
sarrantsvt
Propeller Head
Posts: 46
Joined: Mon Jun 28, 2021 8:02 am

Re: Avoid page break after headings

Post by sarrantsvt »

As far as I know, you can say avoid, but you can't say never. There's no "keep-with-next" like there is in Word. You could wrap the hed and the following para in a DIV -- maybe something like:

Code: Select all

div.keeptogether
{
	page-break-after: avoid;
	page-break-inside: avoid;
}
Sometimes you just have to look at it after generating the target and then go back and put an explicit page break (Insert > Text > Page Break) before the element to keep it with the following.
Doing Online Help since 1990. I remember "dots" .........
Got a bug? https://www.madcapsoftware.com/feedback/bugs/
Got a suggestion? https://www.madcapsoftware.com/feedback ... quest.aspx
andy_smith
Propeller Head
Posts: 24
Joined: Wed Jun 16, 2021 5:41 am

Re: Avoid page break after headings

Post by andy_smith »

Hi, thanks for the reply.

Hard page breaks are what I've been using but because I'm single sourcing the with a lot of conditional text the page breaks appear at different points for different targets. I had considered wrapping it in a div before I did my intermediate Flare training, which is where I heard there was a page break avoid option. I might have to try that after all.

One thing that I did wonder is that the instance that is being really stubborn is where an image is immediately after a heading so I was wonderring if the code only works with text. I was going to experiment further but I'd already sunk too much time into it.

Thanks for your thoughts, I'll keep trying and report back if I discover anything.
I'm on UK time (UTC+0). I work Tuesday, Wednesday and Thursday so I may not see replies outside of those days.
sarrantsvt
Propeller Head
Posts: 46
Joined: Mon Jun 28, 2021 8:02 am

Re: Avoid page break after headings

Post by sarrantsvt »

andy_smith wrote: One thing that I did wonder is that the instance that is being really stubborn is where an image is immediately after a heading so I was wonderring if the code only works with text. I was going to experiment further but I'd already sunk too much time into it.
You can include the img in a div as well as text content, if that is what you are asking.
Doing Online Help since 1990. I remember "dots" .........
Got a bug? https://www.madcapsoftware.com/feedback/bugs/
Got a suggestion? https://www.madcapsoftware.com/feedback ... quest.aspx
ChoccieMuffin
Senior Propellus Maximus
Posts: 2630
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Avoid page break after headings

Post by ChoccieMuffin »

If you can share the code for that section (the heading followed by the image) we might be able to help.

A few questions for you:

1. Is the image just too big (long) to fit on the page with the heading as well? If you temporarily make the image smaller, does the topic work as you want it to?
2. Do you have page-break-after: avoid; applied to the paragraph that contains the image? If so, Flare has to try to work out for itself where to put a break, and sometimes it doesn't come to the same conclusion as a human would.

Let us see the code and we can try to help.
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Post Reply