Question

I am using css to style the background for a link. I have set the anchor tag display to block and given it a width and height value. However, the link text is not aligned vertically. I tried setting the line height to the height of the tag which works but I'm not sure if this is the correct solution or if it works on all browsers. Thanks in advance for any suggestions.

No correct solution

OTHER TIPS

Yes line-height will work moving the text to background. But there are less knock-on effects to using the background-position property to align the background to the text.

background-position: x y;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top