Forum How do I...?

Sidenotes margins on top and bottom of the page

javib
I have sidenotes floated to the margin using -prince-float-reference they generally work great. When the sidenote references are too close prince stack them nicely but I would like to add a little bit of extra space either top or bottom so the sidenotes can be easily identified. I add some margin-top and bottom which works great until the note is at the very end or the very top of the page.

I read that prince does not know the position of the element referenced to the page but I was wondering how could I solve this issue which is basically removing the margin-top or margin-botton when the sidenote is at start or end of the page.

Many thanks!