Forum Bugs

Apparent top padding in header margin

whittaker007
Hi, I have applied a background to the header margin area and diverted a div from the normal flow to fill the header which has a different background applied. When the page is rendered to PDF the background of the header margin extends right to the top of the page, but the background of the header div does not. There is a small gap of a few mm between the two.

I am aware that the element which is being diverted to the header area will loose many of it's properties in the conversion, so I have wrapped my header element in a container div and diverted that container into the header margin so the header div inside retains all it's CSS properties.

I have no margins or padding on these elements, and I have tried applying a blanket rule of
* { margin: 0; padding: 0; }
to the CSS, but the gap persists. It does not respond to changes in the base font size.
whittaker007
Never mind - the gap was caused by the difference in height between the specified top margin of the page and the actual header contents which were aligned bottom.

Is it possible for the top margin to be automatically sized to fit it's contents like a block level element?
mikeday
At the moment there is no way to vary the size of the page margins dynamically based on the content that they contain. A possible work around for this if you only have one page to deal with would be to use a page float, which will take up space based on its content.