I am trying to make a box with scrolling text inside. The problem is, when the text is halfway up the box, it is showing outside it when I expect it to be clipped.
The HTML/CSS is very simple and I have no clue what could be going wrong :
#vbox {
width: 100px;
height: 500px;
overflow: hidden;
background: #afa;
}
#vtext {
position: absolute;
width: 100px;
top: 250px;
}
<div id="vbox">
<div id="vtext">
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa.</p>
<p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p>
<p>Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.</p>
<p>Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.</p>
<p>Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi.</p>
<p>Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a,</p>
</div>
</div>
See Question&Answers more detail:os