锚标记上的边框底部填充

时间:2012-11-24 23:48:52

标签: css header border padding

我在标题中有一个锚标记,我试图在锚标记上放置一个边框底部,这样可行,但是底部的填充太大而负填充不起作用,我该如何绕过此?

直播site

HTML

<div id="featureText">
        <h1>Recent Works / <a href="#">All</a></h1>
    </div>

CSS

#featureText a {
    color: #414042;
    text-decoration: none;
    border-bottom: solid 2px #414042;
    padding-bottom: -2px; }

2 个答案:

答案 0 :(得分:8)

#featureText a {
    line-height: 1em;
    display: inline-block;
    color: #414042;
    text-decoration: none;
    border-bottom: solid 2px #414042;
    padding: 0;
}

答案 1 :(得分:5)

我建议:

#featureText h1 a {
    /* all your other CSS... */
    display: inline-block;
    line-height: 1em;
}