Forum Feature requests

side-heads baseline alignment with adjacent body

chrisryland
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.
howcome
There is some ongoing work on this:

https://www.w3.org/TR/css-align-3/#baseline-values


Edited by howcome

chrisryland
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.
howcome
When you say "sideheads", you mean a headline in a sidenote? As per:

https://css4.pub/2023/sidenotes/

chrisryland
Right.
howcome
Is it not possible to carefully set padding so that the baselines align?
chrisryland
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.
howcome
Why can't you set padding initially? Can you post a picture of your intended rendering?
chrisryland
How would we know unless we did all the CSS calculations ourselves?
chrisryland
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.
  1. CleanShot 2026-06-09 at 11.17.16@2x.png798.5 kB

Edited by chrisryland

howcome
Here's an example where I've set
margin-top: 9px


9px 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.)

  1. foo.html2.7 kB
  2. foo.pdf20.9 kB

Edited by howcome

chrisryland
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.
howcome
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.