The issue is that normally when you are moving from one HTML page to another page that has an ID target element you would be using a link that changes the URL referenced in the web-browser's location bar, thus triggering the scroll-into-view behaviour.
But a Twine based story HTML file is a web-application and the current story formats don't use the location bar to navigate between passages, this means you will need to use JavaScript to trigger the same scroll-into-view behaviour after transitioning from one Passage to another.
The following is one implementation of such a solution, it uses a Story variable to track which ID you want the next passage to scroll to.
1. Initialise the story variable within your project's startup tagged special passage.
(set: $anchor to "")
2. Use a Link with Setter to assign a value to the story variable before going to the Passage containing the target ID'ed element.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
(link: "Next")[
(set: $anchor to "sed")
(goto: "Next")
]
3. Assign the anchor ID (eg "sed") to one of the elements within the target Passage (eg. "Next")
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
<span id="sed">Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.</span>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
4. Use a footer tagged special passage to execute the relevant JavaScript code when the story variable has been assigned an anchor ID. The execution needs to be delayed until after the HTML elements generated for the next passage have been added to the DOM.
note: You can name this passage whatever you like but you will need to remember that name for the next step, I named mine "ScrollIntoView"
(if: $anchor is not "")[
(live: 20ms)[
(stop:)
(print: "<script>document.getElementById('" + $anchor + "').scrollIntoView()</script>")
(set: $anchor to "")
]
]
5. Place CSS like the following within the Story Stylesheet are to hide all visual output generated by the startup and footer tagged special passages, this is where you need to remember the passage name from point 4.
tw-include[type="startup"], tw-include[title="ScrollIntoView"] {
display: none;
}