Source code
Revision control
Copy as Markdown
Other Tools
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<style>
:root, body {
margin: 0px;
}
#spacer {
height: 100vh;
width: 100px;
}
#top_box {
width: 100px;
height: 60vh;
background-color: red;
}
#middle_box {
width: 100px;
height: 60vh;
scroll-initial-target: nearest;
background-color: purple;
}
#bottom_box {
width: 100px;
height: 60vh;
background-color: yellow;
}
</style>
<div id="top_box"><a id="anchor_target_link" href="#anchor_target">Anchor Link</a></div>
<div id="middle_box"></div>
<div id="bottom_box"></div>
<div id="spacer"></div>
<div id="anchor_target">Anchor Target</div>
</body>
</html>