0

I am aware that to autoscroll to a div, I can specify #id in the url as so:
example.com/page#id

How would I construct a url such that the page is scrolled to #id AND the div is centered in the page? This is opposed to the default behavior, which is to just scroll such that the div is positioned touching the top of the page.

1 Answers1

-2

Try Scrolling to a div or sub-div, that before the target Div. You can approximate which div you need based on viewport height.

Or you can use the scroll offset property using javascript.

Example: jquery how to offset scroll position