I need this button
fixed at the bottom of the parent div
and floating over its scrolling content.
I'm really surprised this doesn't work. I expected position: relative
on the parent in combination with bottom: 0
on the fixed element to achieve this..
PS: the button must be inside the div.
div {
position: relative;
width: 200px;
height: 100px;
overflow-y: scroll;
background-color: lightblue;
}
button {
position: fixed;
bottom: 0;
}
body {
height: 200px;
}
<div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Atque, assumenda. Sint optio, praesentium omnis voluptas facilis nam asperiores quod itaque repellat eaque aut molestias reiciendis quibusdam harum rem, cumque nihil!</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus, ab! Tempore sunt eligendi, voluptates quaerat autem reprehenderit perferendis id hic voluptate modi nisi in eaque quasi veniam delectus, voluptatibus quo.</p>
<button>Bütton</button>
</div>