开发者

CSS Align Icon and Text in an LI - Vertical-Align to working

I have this code:

<li id="myLI">
<a id="myAnchor" href="#"&g开发者_Python百科t;
<img src="/icons/icon.png">Click Here</a>
</li>

I need to get the text to align in the middle of the icon (vertically), so I tried adding: vertical-align:middle but it's not working.

Can anyone advice please?

Thanks


#myLI a#myAnchor img{
float:left;
margin:margin to center;
}

Margin to center is the values that you need to give according to the center of the text. eg margin : 5px 5px 0px 2px;

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜