CSS 锚标记上的边框底部填充
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13546851/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 20:52:08 来源:igfitidea点击:
border bottom padding on a anchor tag
提问by Cool Guy Yo
I have a anchor tag inside a header and I am trying to put a border-bottom on the anchor tag, which works, however the padding at the bottom is too large and a negative padding wont work, how do I get around this?
我在标题中有一个锚标记,我试图在锚标记上放置一个边框底部,这有效,但是底部的填充太大并且负填充不起作用,我该如何解决这个问题?
live site
直播现场
html
html
<div id="featureText">
<h1>Recent Works / <a href="#">All</a></h1>
</div>
css
css
#featureText a {
color: #414042;
text-decoration: none;
border-bottom: solid 2px #414042;
padding-bottom: -2px; }
回答by Luca Filosofi
#featureText a {
line-height: 1em;
display: inline-block;
color: #414042;
text-decoration: none;
border-bottom: solid 2px #414042;
padding: 0;
}
回答by David says reinstate Monica
I'd suggest:
我建议:
#featureText h1 a {
/* all your other CSS... */
display: inline-block;
line-height: 1em;
}