welc0meToTheMachine welc0meToTheMachine - 1 year ago 94
CSS Question

How to effectively make div scrollable on hover only, and have it stay in that position when not hovering?

I know I can make a div scrollable on hover by using a fixed height, and by using

normally, and
overflow-y: scroll
on hover.

However, my div is a list of 30 items, and height 50px. If I hover, and scroll down to the 25th item, then move cursor out, the div changes to show the first few items (i.e. top of the div), NOT where I was previously just before moving cursor out.

How can I keep div in same position when I've hovered out?

Answer Source

Working here:


Your CSS just needed to be changed to:

#listOfTags{ overflow:hidden; height: 50px; } #listOfTags:hover{overflow-y: scroll;} 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download