锚定不在页面顶部,而是向下200px [英] Anchor not to top of page, but 200px down
本文介绍了锚定不在页面顶部,而是向下200px的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个锚点在一个元素,使导航跳转到这一点。但是锚点将其直接捕捉到视口的顶部。
I have an anchor on a element which makes the navigation jump to that point. However the anchor snaps it right up to the top of the viewport. Due do a fixed navigation, it's now hidden behind.
是否有可能使锚点不能捕捉到视口的顶部,而是向下翻页200像素?
Is it possible to make the anchor not snap to the top of the viewport and instead 200px down the page?
网站在这里: http://www.haselden .co.uk / james / docs
推荐答案
这个解决方案很脏,但是工作,谢谢@SteveJenkins虽然我添加了一个调整。
Dirty solution for this but does work, thanks @SteveJenkins for coming up with this, though I added a tweak.
<a name="AnchorName" class="anchor">anchor text [invisible]</a>
.anchor {
position: relative;
top: -[number]px;
visibility:hidden;
}
这篇关于锚定不在页面顶部,而是向下200px的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文