Pre-flex, dynamic vertical alignment was one of the main points of CSS pain, so without it (or JS) what you ask becomes impossible. If JS is an option, you can dynamically adjust the spacing (ES6 since it works in shape-outline browsers):
EDIT Updating the viability of common CSS vertical centering methods:
As indicated in the MDN docs, shape-outside applies only to floating elements. This seems to imply that the text should remain in the stream with the element to which you want to apply the formula. As far as I can tell, this limits the interaction only with margin and padding properties, due to how positioning affects the flow of text. Since the height is not fixed in the text block, you cannot use this value in the calc property. In short, your text container should be statically positioned and display: block .
Text packaging is calculated to position: relative and transform , so they are useless.
The cells of the table process the entire contents of the cell as one block (for centering), so the text aligns with the top of the circle, which has a vertical orientation.
It would seem to exclude every CSS-only vertical centering method as a candidate (which I know of).
document.querySelectorAll('.text').forEach((text) => { text.style.paddingTop = `${(200 - text.clientHeight)/2}px`; });
Greg Rozmarynowycz
source share