可滚动的固定div

编程入门 行业动态 更新时间:2024-10-27 10:34:02
本文介绍了可滚动的固定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

本文发布于:2023-10-08 03:10:17,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:div

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!