HTML锚点定位偏移

<a class="target-fix" name="a-<?php $a->id(); ?>"></a>
<artivle>主体内容...</article>

 

将锚点进行偏移,并隐藏占位:

 

.target-fix {
position: relative;
top: -44px; // 偏移值
display: block;
height: 0;
overflow: hidden;
}

posted @ 2017-09-07 10:03  喵尾景虎  阅读(1475)  评论(0编辑  收藏  举报