Forum How do I...?

Prevent heading margin top space on top of the page or column

kumar.j
Hello,

I am new to PrinceXML. I am trying to create HTML + CSS -> PDF using princeXML for our publishing channel.

I have given margin-top: 12pt to h1. How do I prevent heading top space (make it 0) when it occurs on top of the page/column. Does -margin-alt property only works for 'float'?

Best Regards,
Kumar J
howcome
I keep forgetting what the spec says where, but Prince will typically cut the top margin when the element ends up on top. Attached is a simple example.

Page and column floats reorder content, this is probably not what you are looking for. But here's a guide on what can be achieved:

https://css4.pub/2022/float
  1. foo.html1.4 kB
  2. foo.pdf25.1 kB

Edited by howcome