Forum How do I...?

use absolute positioning in a header

whittaker007
Hi, I have a reasonably complex header layout whose content is taken from the document by placing it into the header flow instead of the document flow. I need to position one of the elements (an svg logo) in the header space without displacing any other elements in the header. The obvious way to do this is to give the header div relative positioning and position the logo div absolutely within it.

Unfortunately giving the logo div an absolute position makes it disappear entirely. I put a nice fat (20cm) red border on it to make sure, and there is no trace of it whatsoever. If I use relative positioning or float it and position it with margins, I can pretty much get it where I want it, but both of those methods disturb other elements in the header.

Is there any way round this?
whittaker007
OK I have discovered that if I insert another container inside the header div that encloses all the contents and relatively position that then I get the intended effect.

So it appears that creating a flow out of the header div changes it fundamentally so that positioning no longer applies to it - perhaps it isn't even a div anymore?

Anyway despite the workaround, it is a bit inconvenient to have to double-wrap re-flowed elements. It would seem to make more sense if the integrity of the re-flowed element remained intact. If this presents issues for the software behind the scenes, perhaps the software could wrap the re-flowed element in another anonymous div which could be converted into a flow, so that the original element is preserved intact within the new flow?
mikeday
There are some quirks at the moment affecting elements that get taken out of the normal flow. I've added this issue to the roadmap and we'll see if we can fix it in a future release.
mikeday
We have fixed this issue in Prince 6.0 rev 3, and it should now be possible to apply positioning to an element that has been taken out of the normal flow and placed in a page margin box. Thanks for raising the issue! :)
whittaker007
That's great, thanks!