第一种方法用js来解决,来动态设置padding top 用这句代码 document.body.style.paddingTop=document.querySelector('.top-bar').clientHeight 第二种方法 position:sticky