I have a centered div(inner) in another div(outer). If the inner div is bigger than the outer div i want to have scrollbars to scroll to the top or bottom of the element. Sadly I can't scroll to the top completely. I think this is caused by the transform:translate trick.
.outer {
overflow: scroll;
width:100%;
height:100%;
position:relative;
}
.inner {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
background-color:red;
overflow:hidden;
}
/* normalize */
body,html{
width:100%;
height:100%;
margin:0;
padding:0;
}
<div class="outer">
<div class="inner" style="width: 100px; height: 800px;">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</div>
</div>
I used inline-style for the width and height of the inner div because im changing this with js dynamically.
This question was asked before here. But noone unterstood what hes trying to do.