Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<title>CSS Overflow Test: ::scroll-marker dynamic creation and removal</title>
<link rel="match" href="scroll-marker-dynamic-ref.html">
<style>
#scroller {
width: 600px;
height: 300px;
overflow: scroll;
scroll-marker-group: after;
}
#scroller div {
width: 600px;
height: 300px;
margin-bottom: 20px;
background: green;
}
#scroller::scroll-marker-group {
border: 3px solid black;
padding: 5px;
height: 20px;
display: block;
}
#scroller div::scroll-marker {
content: "";
width: 10px;
height: 10px;
background-color: blue;
border-radius: 100%;
display: inline-block;
}
#scroller div::scroll-marker:target-current {
background-color: aqua;
}
</style>
<div id="scroller">
<div id="first"></div>
</div>
<script>
let div = document.createElement("div");
scroller.appendChild(div);
document.documentElement.offsetTop;
scroller.removeChild(first);
</script>