html - 导航菜单onclick滚动问题?
问题描述
当我点击标题导航菜单时,它会滚动到相应的部门,但有些部分隐藏在粘性标题后面。如何用 css 解决这个问题。
下面是我的小提琴链接
`https://jsfiddle.net/6t8d1Lne/1/
解决方案
为所有部分添加等于标题高度的额外填充,并减去负边距中的额外填充,例如
.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;
}
推荐阅读
- c++ - 使用时出现向量库错误
- ios - 在企业 iOS 应用程序中,如何在现有配置文件过期后替换设备上的 *.mobileprovision 文件,但无需重新签署 IPA?
- javascript - 比较两个 javascript 数组并删除重复条目
- python - discord.py:“JpegImageFile”对象没有属性“startswith”
- oracle - 使用包含 GROUP BY 子句的表连接重写查询
- r - 使用 purrr::map (unlist, t, as_tibble) 在 R 中取消嵌套 JSON 时丢失名称
- java - 在tomcat中加载Spring MVC jar
- linux - shorten awk command pipes
- fasta - 在验证 GFF 和 FASTA 等生物文件格式时,验证器应该检查什么样的错误
- git - 如何取消提交远程存储库中的所有文件