I have a responsive element where its width and height will both scale. Inside this I have some text which I want to center vertically.
How can I set the text’s line-height to be the same as its parent if I don’t know the parent’s height?
line-height: 100% is relative to the font’s regular height so this doesn’t help…
Here’s another way to center an element vertically. I came across this technique some time ago. Basically it uses a pseudo element and vertical-align: middle.