粘性标题包含锚点文本 [英] Sticky Header Covers Anchor Text

查看:135
本文介绍了粘性标题包含锚点文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个粘性标题浮在页面的其余部分。当我链接到页面锚点时,当然是滚动,以便锚点位于页面的顶部。但是,当这种情况发生时,标题会覆盖下面的文本。

I have a sticky header that floats over the rest of the page. When I link to page anchors, of course is scrolls so that the anchor is at the top of the page. However, when this happens the header covers up the text beneath.

有什么地方可以解决这个问题吗?我不能只是移动锚点,因为在页面上有很多他们,每个人有不同的文字量。

Is there someway to fix this? I can't just move the anchor down because there are many of them on the page and each one has a different amount of text following. My first though was to somehow scroll to some height above the anchor.

感谢,
David

Thanks, David

推荐答案

:target伪元素可能是你正在寻找的。使用:target可以寻址用#-mark指出的元素。详细了解相关信息此处

The :target pseudo element could be what you are looking for. With :target you can address the element that is pointed out with the #-mark. Read more about it here

这篇关于粘性标题包含锚点文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆