Source code

Revision control

Copy as Markdown

Other Tools

<!DOCTYPE html>
<meta name="assert" content="green box should be below the yellow box (ref)">
<style>
body, html {
margin: 0;
padding: 0;
}
.spacer {
height: 300px;
}
#anchor {
background: yellow;
width: 100px;
height: 50px;
}
#anchored {
position: absolute;
top: 350px;
left: 0;
background: green;
width: 100px;
height: 50px;
}
</style>
<div class=spacer></div>
<div id="anchored"></div>
<div id="anchor"></div>
<div class=spacer></div>
<script>
document.documentElement.scrollTop = 400;
</script>