Is there a way to use CSS only to keep vertical text aligned next to other elements without any awkward white space or incorrect sizing issues? One method I've tried involves setting the position to sticky, but this creates problems with calculating height and scrolling beyond the parent element:
https://i.sstatic.net/Nnxag.png
Using techniques like transform:rotate
, negative margins, or similar approaches only seem to exacerbate the issue. The challenge lies in correctly determining the height of the text relative to its container.
Another attempt at solving the problem
h2 {
position: sticky;
top: 120px;
margin: 0;
left:32px;
transform-origin: top left;
font-weight: 900;
overflow: visible;
white-space: nowrap;
writing-mode: vertical-lr;
}
I've experimented with various solutions including adjusting height, width, margins, rotation, transforms, and text orientation. Is there a way to achieve correct sticky positioning for vertically-oriented text within a parent element while maintaining proper alignment?