I also tried position: absolute, like the OP did many years ago. Same effect: Page break between ::before and the element. This is a show stopper for me.
I tried instead to use a background image for the note icon, with background-repeat: no-repeat.
That fixes the problem of having a page break between the icon and the note text.
But it raises a new problem. When a long note is broken across pages, the second page again gets a background image. I do not want that. Is there a way of making no-repeat really mean no-repeat?
Thanks, I tried margin-top, and as you point out, it is better. But not perfect. In two volumes of 700+ pages with hundreds of notes each, a higher success rate isn't good enough.
I noticed that too. Unfortunately, I need the "Note" text before the first paragraph, and I don't know how to add an icon and text at the same time as ::before. And I can't add the icon as the background image to the first paragraph--it might not be long enough to contain it.
Given your orphans/widows settings, paragraphs will often move to the next page from where its container is started. So, attaching icons to the container will result in empty icons.
I suggest solving the "Note" text some way; rather than generating a block-level container element, you could generate a inline-level span element at the beginning of a paragraph. The "Note" text could be attached to this element.
Many years ago I proposed chaining pseudo-elements, where you could do:
Thanks, I took out the widows/orphans. Volume I of the book now has no breaks after the icons, just a few notes with unfortunate orphans. Definitely better.
Do you think it is a bug to break after a float in ::before? If so, I'll file a bug report.
Unfortunately, when I tried it, there were instances of page breaks that place the icon on the bottom of one page and the note on the top of the subsequent page.
That's not a viable solution. The container (here div.Note) can be long enough that it must be broken across pages.
Such a break should just not separate the decoration (be it a float, a sidenote, or a background image) from the container body.
Have another look at the sample that I posted as "Here you go" four posts previously. Why is the Note icon present at the bottom of page 2 without any part of the note's content? Perhaps the computation naively thinks that the icon fills the vertical space, so a break must be taken? But why? There is no widow/orphan statement that would have prevented a line or two of the content to be included on page 2. Clearly some of the content fits, and I believe it should appear before the break.