首页 > 解决方案 > 导航菜单onclick滚动问题?

问题描述

当我点击标题导航菜单时,它会滚动到相应的部门,但有些部分隐藏在粘性标题后面。如何用 css 解决这个问题。

下面是我的小提琴链接

      `https://jsfiddle.net/6t8d1Lne/1/

标签: htmlcss

解决方案


为所有部分添加等于标题高度的额外填充,并减去负边距中的额外填充,例如

.section-f {
        background: #75D5A7;
        color: #fff;
        font-weight: 350;
        padding: 150px /*assunming your header height is 100px so I add 100px in 50px padding*/;
        margin-top: -100px; /*extra padding removed*/
        font-family: Roboto;
    }

推荐阅读