I want to use a text as the background for another text. Basically, this is quite easy by using two div
elements with appropriate position
and z-index
settings, as described in Is there a way to use use text as the background with CSS?.
My problem is that I want to align both texts, although they are different in size. The background text is bigger, and the foreground text shall be aligned vertically with the background one, so that both texts' vertical center is at the same position.
I can achieve this by manually adjusting the position in pixels, but I have to do this for every font-size I want to use individually. Moreover, I can never be sure that this works in every browser in the same way.
Is there a better alternative to do this?