使滚动条仅在Div悬停在其上时可见? [英] Make scrollbars only visible when a Div is hovered over?

查看:64
本文介绍了使滚动条仅在Div悬停在其上时可见?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想弄明白如何有一个可滚动的div只显示滚动条时Hovered。



示例是Google图片搜索,在下面的图片中,您可以看到左侧边栏是否显示为可滚动,直到您将鼠标悬停在其上。 p>

这是否可能与CSS或是需要Javascript?如果可能,可能是一个快速示范如何执行此类任务?



解决方案

  div {overflow:hidden; height: } 
div:hover {overflow-y:scroll; }

这样的东西能工作吗?


I am trying to figure out how to have a scrollable div that only shows its scrollbars when Hovered.

Example is Google Image search, in the image below you can see how the left sidebar does not appear to be scroll-able until you hover the mouse over it.

Is this possible with CSS or is Javascript required? If possible maybe a quick example how to do such a task?

解决方案

div { overflow:hidden;height:whatever px; }
div:hover { overflow-y:scroll; }

Would something like that work?

这篇关于使滚动条仅在Div悬停在其上时可见?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆