我有固定元素和滾動條的問題。有沒有辦法將父元素的滾動條後面的固定元素移動?這裏是fiddle。父元素的固定元素疊加滾動條
body {
margin: 0;
}
.scrollable-container {
height: 100vh;
overflow-y: scroll;
}
.very-long-content {
height: 5000px;
}
.fixed-element {
background-image: url(http://space-kids.org/wp-content/uploads/2016/02/jupiter.png);
background-size: 100% 100%;
height: 300px;
position: fixed;
right: -100px;
top: calc(50% - 150px);
width: 300px;
}
<section class="scrollable-container">
<section class="very-long-content">
<div class="fixed-element"></div>
</section>
</section>
設置'的z-index:-1;' –