Fixed page header overlaps in-page anchors

前端 未结 30 2794
逝去的感伤
逝去的感伤 2020-11-22 00:25

If I have a non-scrolling header in an HTML page, fixed to the top, having a defined height:

Is there a way to use the URL anchor (the #fragment part) t

30条回答
  •  温柔的废话
    2020-11-22 00:56

    The way that I find being the cleanest is the following one :

      #bar::before {
        display: block;
        content: " ";
        margin-top: -150px;
        height: 150px;
        visibility: hidden;
        pointer-events: none;
      }
    

提交回复
热议问题