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.

Pas de solution correcte

Autres conseils

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;
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top