固定顶栏与命名锚点 [英] Fixed topbar vs named anchors
问题描述
我有一个顶部有 position:fixed
,它还包含锚链接(< a href =#someid> jdjd<问题是目标放在视口的顶部(固定顶部栏后面)。
我如何修复浏览器滚动,使目标显示在顶部栏下面?
不知道为什么你被downvoted,它似乎是一个诚实的好问题。
我会把一个 margin-top
,等于固定顶栏的高度。
http://jsfiddle.net/justiceerolin/KfMLJ/ 作为示例
I have a topbar with position:fixed
which also contains anchor links (<a href="#someid">jdjd</a>
).
The problem is that the target is placed in the top of the viewport (behind the fixed topbar).
how can I fix so the the browser scrolls so that the target is shown just below the topbar?
Not sure why you're being downvoted, it seems like an honest a good question.
I'd put a margin-top
on the viewport, equal to the height of the fixed topbar.
http://jsfiddle.net/justiceerolin/KfMLJ/ as an example
这篇关于固定顶栏与命名锚点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!