三生石@ 2012-05-24 07:04 采纳率: 50%
浏览 541

抵销一个 html 锚为固定标头[重复]调整

This question already has an answer here:

I am trying to clean up the way my anchors work. I have a header that is fixed to the top of the page, so when you link to an anchor elsewhere in the page, the page jumps so the anchor is at the top of the page, leaving the content behind the fixed header (I hope that makes sense). I need a way to offset the anchor by the 25px from the height of the header. I would prefer HTML or CSS, but Javascript would be acceptable as well.

</div>

转载于:https://stackoverflow.com/questions/10732690/offsetting-an-html-anchor-to-adjust-for-fixed-header

  • 写回答

28条回答 默认 最新

  • 撒拉嘿哟木头 2012-02-28 13:02
    关注

    For the same issue, I used an easy solution : put a padding-top of 40px on each anchor.

    评论

报告相同问题?