the trashcan moves up when scrolling down and it doesnt span over the full width of the parent div
I want it to be like this:
.ParentDiv {
background: red;
overflow-y: scroll;
border: none;
float: left;
position: relative;
height: 80px;
width: 200px;
}
#DivAroundTrashcan{
position:fixed;
bottom: 0;
width: 100%;
height: 15px;
}
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<div class="ParentDiv" id="ParentDiv" >
<p1><center>efgf </center></p1>
<p2><center>wefwf </center></p2>
<p3><center>wefwef </center></p3>
<p4><center>wefwef </center></p4>
<p5><center>wefwef </center></p5>
<p6><center>wefweff </center></p6>
<p7><center>wefwef</center></p7>
<p8><center>wefwef </center></p8>
<div id="DivAroundTrashcan"><input type="button"id="Trashcan"value="🗑"></div>
</div>
</body>
</html>
position:absolute; just makes it stay where it is, but when scrolling it doesnt stay in place
You can use flex on your container:
html,
body {
height: 100%;
margin: 0;
}
.container {
display: flex;
flex-direction: column;
/*following is for demo only - not sure what gives your container height */
height: 100%;
}
.scroll {
flex-grow: 1;
overflow: auto;
}
.bin {
text-align: right;
}
<div class="container">
<div class="scroll">
content<br>content<br>content<br>content<br>content<br>content<br>content<br> content
<br>content<br>content<br>content<br>content<br>content<br>content<br> content
<br>content<br>content<br>content<br>content<br>content<br>content<br> content
<br>content<br>content<br>content<br>content<br>content<br>content<br> content<br>content<br>content<br>content<br>content<br>content<br>content<br>
</div>
<div class="bin">bottom bin content</div>
</div>