<!DOCTYPE html> | |
<style> | |
.fixed { | |
position: fixed; | |
} | |
.sticky { | |
position: sticky; | |
top: 0; | |
} | |
.composited { | |
/* Force compositing without creating a stacking context */ | |
backface-visibility: hidden; | |
} | |
.spacer { | |
height: 2000px; | |
} | |
.container { | |
width: 500px; | |
height: 500px; | |
overflow: scroll; | |
} | |
</style> | |
<div class="composited fixed"> | |
Ref text. | |
<div class="composited container"> | |
<div class="sticky"> | |
This line should line up with the text above. | |
</div> | |
<div class="spacer"></div> | |
</div> | |
</div> | |