开发者

vertically center link in li

开发者 https://www.devze.com 2023-04-02 10:45 出处:网络
This is supposed to be a horizontal menu bar. I\'m struggling to vertically center the text. Any advice?

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

精彩评论

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