点击锚点让定位偏移顶部

最近遇到的问题是:网页多出需要设置锚点,但网站顶部导航采用float:fixed绝对定位,浮动于顶部。那么问题来了,锚点定位必然定位于页面顶部,这样一来就会被浮动的导航遮挡。 解决的方法是在主体内容前加一个暗锚: [fusion_syntax_highlighter theme=”” language=”x-sh” line_numbers=”” line_wrapping=”” copy_to_clipboard=”” copy_to_clipboard_text=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” class=”” id=”” font_size=”” border_size=”” border_color=”” border_style=”” background_color=”” line_number_background_color=”” line_number_text_color=”” margin_top=”” margin_left=”” margin_bottom=”” margin_right=””]PGEgY2xhc3M9InRhcmdldC1maXgiIG5hbWU9ImEtPD9waHAgJGEtPmlkKCk7ID8+Ij48L2E+IDxhcnRpdmxlPuS4u+S9k+WGheWuuS4uLjwvYXJ0aWNsZT4=[/fusion_syntax_highlighter] 将锚点进行偏移,并隐藏占位: [fusion_syntax_highlighter theme=”” language=”x-sh” line_numbers=”” line_wrapping=”” copy_to_clipboard=”” copy_to_clipboard_text=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” class=”” id=”” font_size=”” border_size=”” border_color=”” border_style=”” background_color=”” line_number_background_color=”” […]

点击锚点让定位偏移顶部 Read More »