3 ms·
There's no easy solution to this. Mainly because CSS barely knows what a baseline is and there's very little in CSS that affects the baseline or something to th
by talmand 11y ago
There's no easy solution to this. Mainly because CSS barely knows what a baseline is and there's very little in CSS that affects the baseline or something to that effect. What we call baseline can vary from font-to-font, browser-to-browser, platform-to-platform; all affecting how the font gets rendered.
Plus, based on the description and requirements of the problem it's likely to not be solved because the font-size is an unknown variable in the equation. If it was known how the font-size is determined and applied then maybe something could be leveraged to adjust for the problem.
The easy solution, knowing the font size, is to position a parent element at the coordinate and then move a child element containing the text upward an amount based on the font-size. That way the first line of text in the child element sits on the top line of the parent element, more or less. But we don't know the font-size and it is easily broken if the site is constantly being changed code-wise. In fact, a badly thought out line-height may break it as well.