开发者

vertically center link in li

This is supposed to be a horizontal menu bar. I'm struggling to vertically center the text. Any advice?

<ul id="header-menu">
    <li id="header-logo"></li>
    <li id="header-v-space"></li>
    <li id="header-menu">
        <a href="/discover">
            <strong>Discover</strong><span开发者_如何学JAVA>great things</span>
        </a>
    </li>
    <li id="header-v-space"></li>
    <li id="header-menu">
        <a href="/share">
            <strong>Share</strong><span>opportunities</span>
        </a>
    </li>
    <li id="header-v-space"></li>
</ul>


I normally got these results by specifying a height which is identical to the line-height while setting the top- and bottom-padding to zero.

li {
    padding: 0 .5em;
    height: 2em;
    line-height: 2em; }
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜