可滚动的固定div [英] scrollable fixed div

查看:119
本文介绍了可滚动的固定div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在浏览器侧面的div中有一个菜单,我想将它保持在固定位置。但是,菜单可能会超出某些屏幕的高度,并导致无法访问的链接。所以我想在这种情况下使菜单滚动。不幸的是,组合

  position:fixed; 
溢出:auto; (或滚动)

并不真正起作用。即滚动条淡出(不可移动)。有没有办法?
在此先感谢

编辑



菜单类似于在此页面上向右转。只有一点点大。如果您打开该页面并降低浏览器窗口的高度,则部分菜单仍将无法访问。这就是我想要避免的。
并且不,我的解决方案在IE,Chrome,Opera或Firefox中不起作用。

解决方案

将这些添加到你的声明:

  top:0; 
bottom:0; / *或高度:100%; * /

您可以用较大的值替换零以增加页边距。


I have a menu in a div on the side of the browser and I would like to keep it in the fixed position. However, the menu may exceed height of some screens and that would result inaccessible links. So I would like to make the menu scrollable in such a case. Unfortunately the combination

position: fixed;
overflow: auto; (or scroll)

doesn't really work. I.e. the scrollbar is faded out (immovable). Is there a way? Thanks in advance

EDIT

The menu is similar to the one to the right up on this page. Only a bit larger. If you open that page and decrease the height of your browser window, part of the menu remains inaccessible. That's what I want to avoid. And no, my solution doesn't work in IE, Chrome, Opera or Firefox.

解决方案

Add these to your declarations:

top: 0;
bottom: 0; /* or height: 100%; */

You can replace the zeroes with larger values to add margins.

这篇关于可滚动的固定div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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