Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在带有固定位置菜单的页面中修复链接锚的位置,问题Fixed position navbar obscures anchors对我有用,但是链接的背景颜色已扩展到填充的高度,我该如何更改为字体高度。谢谢
您可以更改background-clip属性以指定是否填充background-coloruntil padding-box/content-box或border-box。
background-clip
background-color
padding-box
content-box
border-box
默认值为border-box。要仅填充内容,请使用content-box
background-clip: content-box;
演示