mirror of
https://github.com/servo/servo.git
synced 2025-07-22 06:43:40 +01:00
104 lines
2.1 KiB
HTML
104 lines
2.1 KiB
HTML
<!DOCTYPE html>
|
|
<title>position:sticky elements should respect the bottom constraint</title>
|
|
<link rel="match" href="position-sticky-bottom-ref.html" />
|
|
<link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos" />
|
|
<meta name="assert" content="This test checks that position:sticky elements obey their bottom anchor after scrolling" />
|
|
|
|
<style>
|
|
.group {
|
|
display: inline-block;
|
|
position: relative;
|
|
width: 150px;
|
|
height: 250px;
|
|
}
|
|
|
|
.scroller {
|
|
position: relative;
|
|
width: 100px;
|
|
height: 200px;
|
|
overflow-x: hidden;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.contents {
|
|
height: 500px;
|
|
}
|
|
|
|
.prepadding {
|
|
height: 200px;
|
|
}
|
|
|
|
.container {
|
|
height: 200px;
|
|
}
|
|
|
|
.filler {
|
|
height: 100px;
|
|
}
|
|
|
|
.indicator {
|
|
background-color: red;
|
|
position: absolute;
|
|
left: 0;
|
|
}
|
|
|
|
.sticky {
|
|
background-color: green;
|
|
position: sticky;
|
|
bottom: 25px;
|
|
}
|
|
|
|
.box {
|
|
width: 100%;
|
|
height: 100px;
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
window.addEventListener('load', function() {
|
|
document.getElementById('scroller1').scrollTop = 100;
|
|
document.getElementById('scroller2').scrollTop = 175;
|
|
document.getElementById('scroller3').scrollTop = 250;
|
|
});
|
|
</script>
|
|
|
|
<div class="group">
|
|
<div id="scroller1" class="scroller">
|
|
<div class="indicator box" style="top: 200px;"></div>
|
|
<div class="contents">
|
|
<div class="prepadding"></div>
|
|
<div class="container">
|
|
<div class="filler"></div>
|
|
<div class="sticky box"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="group">
|
|
<div id="scroller2" class="scroller">
|
|
<div class="indicator box" style="top: 250px;"></div>
|
|
<div class="contents">
|
|
<div class="prepadding"></div>
|
|
<div class="container">
|
|
<div class="filler"></div>
|
|
<div class="sticky box"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="group">
|
|
<div id="scroller3" class="scroller">
|
|
<div class="indicator box" style="top: 300px;"></div>
|
|
<div class="contents">
|
|
<div class="prepadding"></div>
|
|
<div class="container">
|
|
<div class="filler"></div>
|
|
<div class="sticky box"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div>You should see three green boxes above. No red should be visible.</div>
|