如大家在 segmentfault 当前版本所见到的,点击锚点链接后,展示的内容会因为 header 区的浮动而被遮盖。
示例链接 http://segmentfault.com/q/10100000001...
当
可用的方法之一就是拉伸锚点的边距,但这会影响整个列表的距离,不知道大家有什么好的方法不?
解决方案
看看这个?把a的top做点offset试试?
http://stackoverflow.com/questions/49...
参照 stackoverflow 的做法,在主体内容前加一个暗锚
<a class="target-fix" name="a-<?php $a->id(); ?>"></a><artivle>主体内容...</article>
将锚点进行偏移,并隐藏占位:
.target-fix { position: relative; top: -44px; // 偏移值 display: block; height: 0; overflow: hidden;}