For a while, I was able to hide the controls on my page using position:absolute;
and bottom:-36px
, which made them pop up when hovering over the player. Recently, however, I noticed that I can now scroll down to see them. How can I maintain the slide-up effect without this scrolling issue?
Additionally, I set the controls div with line-height:36px
expecting it to be 36px in height, but it is actually 38px. This extra 2px of space makes bottom:-36px
somewhat ineffective since 2px are still visible. I'm wondering where these extra pixels are coming from.
Any advice on how to resolve these issues and understand the cause would be greatly appreciated. Thank you.
EDIT1:
Thanks to Fahad, I was able to solve the initial problem by adding position:relative;
to the parent div. However, I'm still puzzled as to why line-height
adds those mysterious extra pixels.
Assigning a relative position to the parent div uncovered another issue - sometimes, when scrolling inside the "player," the controls no longer stay at the bottom. Take a look for yourself:
Explore the updated sample here
EDIT2:
It seems that replacing position:absolute;
with position:fixed;
in the controls div easily resolves the scrolling problem. I am currently testing to ensure that this adjustment does not interfere with any other aspects of the design.