side-heads baseline alignment with adjacent body
Sure would be nice if there were some way to align baselines across the first lines of floating side-heads and associated text. We had to hack this in as a multi-pass fixup.
There is some ongoing work on this:
https://www.w3.org/TR/css-align-3/#baseline-values
Edited 9 Jun 2026 by howcome
That's good to know, thanks. But could it work across sideheads and main flow text in Prince? Don't see how those could be in the same alignment containers.
When you say "sideheads", you mean a headline in a sidenote? As per:
https://css4.pub/2023/sidenotes/
Is it not possible to carefully set padding so that the baselines align?
that's what we do after the fact in a post-pass. Just wondered if there were some way to do that in CSS so Prince could handle on first pass.
Why can't you set padding initially? Can you post a picture of your intended rendering?
How would we know unless we did all the CSS calculations ourselves?
This is what our post-pass adjustment does.
Without the adjustment, the heading would be top-aligned with the main text first line, which is pretty ugly.
CleanShot 2026-06-09 at 11.17.16@2x.png 798.5 kB
Edited 9 Jun 2026 by chrisryland
Here's an example where I've set
margin-top: 9px9px is a length I've found, so it's not quite automatic. But it should apply to all "sideheads", so the burden is manageable.
(Long headlines that split across pages will cause trouble.)
foo.html 2.7 kB foo.pdf 20.9 kB
Edited 9 Jun 2026 by howcome
but if we're using user-specified fonts & leading & margins & etc, how would we know what that value is computationally? Seems impossible without either direct CSS support or a post-pass like we're doing now.
Right, if you need an automatic solution, the box-tracking API provides a solution. But, if you do the full design and write the style sheet by hand, you can quite easily find the right value.