Trying to remove space before h1 on PDF output

This forum is for all Flare issues related to PDF, eBook, Microsoft Word, Adobe FrameMaker, XPS, and XHTML book targets.

Trying to remove space before h1 on PDF output

Postby LampTramp on Fri Jan 24, 2014 9:38 am

I am currently designing a new stylesheet and page layout for PDF output from Flare 9.

The page layout uses two columns. The content flows in fine apart from I'm getting an unwanted space above the top level heading. The h1 level will be used for chapter headings and I want it to sit at the top of the left column on a new page. Even though there is no margin, border or padding set above the h1 style in the stylesheet (Medium: print), it is still sitting about a line down from the top of the left column. The text that then flows into the right hand column then sits at the very top, so it shows up the problem with the h1.

Any ideas where I might look to prevent this from happening?

Thanks in advance.
LampTramp
Propeller Head
 
Posts: 11
Joined: Wed Nov 06, 2013 4:00 am

Re: Trying to remove space before h1 on PDF output

Postby whunter on Fri Jan 24, 2014 9:49 am

In the target, on the Advanced tab, select "Collapse top margin at top of page/column".
whunter
Sr. Propeller Head
 
Posts: 429
Joined: Thu Mar 12, 2009 4:49 pm
Location: Portland, OR

Re: Trying to remove space before h1 on PDF output

Postby LampTramp on Fri Jan 24, 2014 10:03 am

whunter wrote:In the target, on the Advanced tab, select "Collapse top margin at top of page/column".


Yep, that's already set in the target and it's still putting the space in there - anywhere else that might cause this to happen?
LampTramp
Propeller Head
 
Posts: 11
Joined: Wed Nov 06, 2013 4:00 am

Re: Trying to remove space before h1 on PDF output

Postby LTinker68 on Fri Jan 24, 2014 10:48 am

Check to make sure you don't have a margin-top and padding-top values specified for the h1 tag, especially in the print medium. Also check the body tag in the print medium. If there's no margin-top or padding-top expressly stated for the body tag, then you might want to set both to a value of 0 in the print medium. It might have a default value in one of Flare's stylesheet or it might use the default value in browsers, and that default value would be inherited by the body tag in the page layout frame (which is a DIV). Setting it to 0 will override that default value.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
LTinker68
Master Propellus Maximus
 
Posts: 7245
Joined: Thu Feb 16, 2006 9:38 pm

Re: Trying to remove space before h1 on PDF output

Postby LampTramp on Fri Jan 24, 2014 11:05 am

LTinker68 wrote:Check to make sure you don't have a margin-top and padding-top values specified for the h1 tag, especially in the print medium. Also check the body tag in the print medium. If there's no margin-top or padding-top expressly stated for the body tag, then you might want to set both to a value of 0 in the print medium. It might have a default value in one of Flare's stylesheet or it might use the default value in browsers, and that default value would be inherited by the body tag in the page layout frame (which is a DIV). Setting it to 0 will override that default value.


I have removed all other stylesheets apart from the one I'm developing. For the h1 tag in its print medium both the margin-top and padding-top settings are tied to 0em to prevent any inheritance from the body. Not sure where to look next...
LampTramp
Propeller Head
 
Posts: 11
Joined: Wed Nov 06, 2013 4:00 am

Re: Trying to remove space before h1 on PDF output

Postby LTinker68 on Fri Jan 24, 2014 1:52 pm

LampTramp wrote:
LTinker68 wrote:Check to make sure you don't have a margin-top and padding-top values specified for the h1 tag, especially in the print medium. Also check the body tag in the print medium. If there's no margin-top or padding-top expressly stated for the body tag, then you might want to set both to a value of 0 in the print medium. It might have a default value in one of Flare's stylesheet or it might use the default value in browsers, and that default value would be inherited by the body tag in the page layout frame (which is a DIV). Setting it to 0 will override that default value.


I have removed all other stylesheets apart from the one I'm developing. For the h1 tag in its print medium both the margin-top and padding-top settings are tied to 0em to prevent any inheritance from the body. Not sure where to look next...

Did you also explicitly set the margin-top and padding-top values for the body tag to 0 in the print medium?

And to be clear, the other stylesheets I'm referring to are ones that Flare adds/uses when it builds the outputs. You don't have direct access to those stylesheets, at least not through the GUI. If their styles have default values specified -- or if they inherit the default values specified by the W3C -- then those would be inherited by your stylesheet unless you explicitly overrode those default values. That's why I'm saying you might have to add the following to your stylesheet (assuming you are using the "print" medium for your print output):

Code: Select all
@media print {
    body {
      margin-top:0;
      padding-top:0;
    }
}
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
LTinker68
Master Propellus Maximus
 
Posts: 7245
Joined: Thu Feb 16, 2006 9:38 pm

Re: Trying to remove space before h1 on PDF output

Postby LampTramp on Thu Jan 30, 2014 2:44 am

Hi all,

We have now located the cause of the extra space, it was due to the 'margin-top' setting of 10px within the body style. It was thus adding that extra space at the beginning of every topic, but was most noticeable in a multi-column PDF page. My thanks to all who gave advice on this matter and to Lisa and to Matthew Ellison who both nailed it.

Cheers
LampTramp
Propeller Head
 
Posts: 11
Joined: Wed Nov 06, 2013 4:00 am

Re: Trying to remove space before h1 on PDF output

Postby robdocsmith on Mon Aug 26, 2019 10:39 pm

A post that I should bookmark. Unless you explicitly state that body should have no margin and padding, it may well inherit it from elsewhere outside of your control. And then one day you'll be creating a layout and suddenly find a vertical space you can't account for.

So, yes, it's a really good idea to reset body to zero padding and margin as a baseline for all styles in your stylesheet.

Thanks for solving, once again...

Rob
robdocsmith
Propeller Head
 
Posts: 24
Joined: Thu May 24, 2018 3:11 pm


Return to Printed Documentation Targets

Who is online

Users browsing this forum: No registered users and 2 guests

cron