html - Absolute positioned element on a scrollable parent -


i'm trying have child element (something toolbar) of parent element positiond on bottom edge. bahavior should same using position fixed browser view.

i'm using absolute position right now. everyting perfect until parent needs scroll content. toolbar moves along rest of parent's content.

could explain me why toolbar moves? possible achieve task without need javascript?

* {    box-sizing: border-box;  }    .container {    position: relative;    width: 100px;    height: 150px;    overflow-y: auto;    border: 1px solid black;  }    .mock {    height: 200px;    background-color: red;  }    .tool-bar {    position: absolute;    bottom: 0;    left: 0;    right: 0;    height: 40px;    background-color: blue;  }
<div class="container">    <div class="mock"></div>    <div class="tool-bar"></div>  </div>

the toolbar inside scrollable area, that's why scrolled. try code:

html

<div class="container">   <div class="scroll">     <div class="mock"></div>   </div>    <div class="tool-bar"></div> </div> 

css

div.scroll { /* style of .container scroll */ } 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -