相关疑难解决方法(0)

固定页眉与页内锚点重叠

如果我在HTML页面中有一个非滚动标题,则固定在顶部,具有已定义的高度:

有没有办法使用URL锚点(#fragment部分)让浏览器滚动到页面中的某个点,但是在没有JavaScript帮助的情况下仍然尊重固定元素的高度?

http://foo.com/#bar
Run Code Online (Sandbox Code Playgroud)
WRONG (but the common behavior):         CORRECT:
+---------------------------------+      +---------------------------------+
| BAR///////////////////// header |      | //////////////////////// header |
+---------------------------------+      +---------------------------------+
| Here is the rest of the Text    |      | BAR                             |
| ...                             |      |                                 |
| ...                             |      | Here is the rest of the Text    |
| ...                             |      | ...                             |
+---------------------------------+      +---------------------------------+

html url anchor fragment

305
推荐指数
19
解决办法
16万
查看次数

标签 统计

anchor ×1

fragment ×1

html ×1

url ×1