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.

没有正确的解决方案

其他提示

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;
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top