Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一些锚元素,但它们位于绝对位置 div 中,并且 div 的内容太大以至于它在里面滚动(溢出:自动)。
div 中的所有条目在顶部都有一个锚点,但是如果我转到这个锚点,我有我想要的元素直接在侧面的顶部,但我希望它在中心。我需要一些类似偏移的东西,这样我才能跳得比平时更高。
你总是可以添加另一个 div 来包裹它,然后做类似的事情
.wrapperdiv{ position:relative; top:-10px; }
您可以尝试使用 Javascript 滚动来更正位置。